Publish the size of the book before download

- Closes: #62
This commit is contained in:
Las Zenow 2021-02-09 17:32:13 +00:00
parent d81f1b92cd
commit a4b11142b2
2 changed files with 6 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import (
var tmpl_funcs = map[string]interface{}{
"strings_join": stringsJoin,
"download_url": downloadUrl,
"size2mb": size2mb,
}
type Status struct {
@ -97,6 +98,10 @@ func downloadUrl(book database.Book) string {
return fmt.Sprintf("/download/%s/%s", book.ID, fileName)
}
func size2mb(size int) float32 {
return float32(size) / (1024.0 * 1024.0)
}
type DevTemplateExecutor struct {
assetsPath string
tpe string