1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: email reports (resolve #124)

This commit is contained in:
Ferdinand Mütsch
2021-04-30 14:07:14 +02:00
parent 1beca82875
commit 29c04c3ac5
23 changed files with 913 additions and 468 deletions

View File

@ -23,12 +23,13 @@ type action func(w http.ResponseWriter, r *http.Request) (int, string, string)
var templates map[string]*template.Template
func loadTemplates() {
tpls := template.New("").Funcs(template.FuncMap{
func DefaultTemplateFuncs() template.FuncMap {
return template.FuncMap{
"json": utils.Json,
"date": utils.FormatDateHuman,
"simpledate": utils.FormatDate,
"simpledatetime": utils.FormatDateTime,
"duration": utils.FmtWakatimeDuration,
"floordate": utils.FloorDate,
"ceildate": utils.CeilDate,
"title": strings.Title,
@ -53,7 +54,11 @@ func loadTemplates() {
"htmlSafe": func(html string) template.HTML {
return template.HTML(html)
},
})
}
}
func loadTemplates() {
tpls := template.New("").Funcs(DefaultTemplateFuncs())
templates = make(map[string]*template.Template)
// Use local file system when in 'dev' environment, go embed file system otherwise