mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
refactor: split utility functions into utils and helpers
This commit is contained in:
@@ -2,6 +2,7 @@ package routes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/muety/wakapi/helpers"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -24,16 +25,16 @@ func Init() {
|
||||
func DefaultTemplateFuncs() template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"json": utils.Json,
|
||||
"date": utils.FormatDateHuman,
|
||||
"datetime": utils.FormatDateTimeHuman,
|
||||
"simpledate": utils.FormatDate,
|
||||
"simpledatetime": utils.FormatDateTime,
|
||||
"duration": utils.FmtWakatimeDuration,
|
||||
"date": helpers.FormatDateHuman,
|
||||
"datetime": helpers.FormatDateTimeHuman,
|
||||
"simpledate": helpers.FormatDate,
|
||||
"simpledatetime": helpers.FormatDateTime,
|
||||
"duration": helpers.FmtWakatimeDuration,
|
||||
"floordate": datetime.BeginOfDay,
|
||||
"ceildate": utils.CeilDate,
|
||||
"title": strings.Title,
|
||||
"join": strings.Join,
|
||||
"add": utils.Add,
|
||||
"add": add,
|
||||
"capitalize": utils.Capitalize,
|
||||
"lower": strings.ToLower,
|
||||
"toRunes": utils.ToRunes,
|
||||
@@ -106,3 +107,7 @@ func loadTemplates() {
|
||||
func defaultErrorRedirectTarget() string {
|
||||
return fmt.Sprintf("%s/?error=unauthorized", config.Get().Server.BasePath)
|
||||
}
|
||||
|
||||
func add(i, j int) int {
|
||||
return i + j
|
||||
}
|
||||
|
Reference in New Issue
Block a user