diff --git a/repository/util.go b/repository/util.go index 7d31bd1..6e37a2a 100644 --- a/repository/util.go +++ b/repository/util.go @@ -11,7 +11,9 @@ import ( var templates *template.Template func init() { - templates = template.Must(template.New("templates").Funcs(util.TemplateFuncs()).Funcs(TemplateFuncs()).ParseGlob("web/templates/*.gohtml")) + templates = template.New("templates").Funcs(util.TemplateFuncs()).Funcs(TemplateFuncs()) + template.Must(templates.ParseGlob("web/templates/*.gohtml")) + template.Must(templates.ParseGlob("web/templates/**/*.gohtml")) } func Render(w io.Writer, name string, data any) error { diff --git a/web/templates/notifications_tab.gohtml b/web/templates/notifications_tab.gohtml deleted file mode 100644 index 7c431c5..0000000 --- a/web/templates/notifications_tab.gohtml +++ /dev/null @@ -1,24 +0,0 @@ -{{ define "notifications_tab" }} - {{ template "notifications_content" .Data }} -{{ end }} - -{{ define "notifications_content" }} - -
-
- {{ range .Notifications }} -

Time: {{ .Time.String }}

-
- {{ end }} -
-{{ end }} diff --git a/web/templates/items_tab.gohtml b/web/templates/tabs/items_tab.gohtml similarity index 81% rename from web/templates/items_tab.gohtml rename to web/templates/tabs/items_tab.gohtml index a001b83..98fdfb9 100644 --- a/web/templates/items_tab.gohtml +++ b/web/templates/tabs/items_tab.gohtml @@ -3,17 +3,7 @@ {{ end }} {{ define "items_content" }} - + {{ template "tabs" "items" }}
diff --git a/web/templates/tabs/notifications_tab.gohtml b/web/templates/tabs/notifications_tab.gohtml new file mode 100644 index 0000000..10bebe0 --- /dev/null +++ b/web/templates/tabs/notifications_tab.gohtml @@ -0,0 +1,14 @@ +{{ define "notifications_tab" }} + {{ template "notifications_content" .Data }} +{{ end }} + +{{ define "notifications_content" }} + {{ template "tabs" "notifications" }} +
+
+ {{ range .Notifications }} +

Time: {{ .Time.String }}

+
+ {{ end }} +
+{{ end }} diff --git a/web/templates/tabs/tabs.gohtml b/web/templates/tabs/tabs.gohtml new file mode 100644 index 0000000..ab99241 --- /dev/null +++ b/web/templates/tabs/tabs.gohtml @@ -0,0 +1,13 @@ +{{ define "tabs" }} + +{{ end }} \ No newline at end of file diff --git a/web/templates/tabs/today_tab.gohtml b/web/templates/tabs/today_tab.gohtml new file mode 100644 index 0000000..ed6173e --- /dev/null +++ b/web/templates/tabs/today_tab.gohtml @@ -0,0 +1,11 @@ +{{ define "today_tab" }} + {{ template "tabs" "today" }} +
+
+ {{ if .Data.DailyQuota }} + {{ template "daily_quota" .Data }} +
+ {{ end }} + {{ template "meals" .Data }} +
+{{ end }} diff --git a/web/templates/today_tab.gohtml b/web/templates/today_tab.gohtml deleted file mode 100644 index 67e702e..0000000 --- a/web/templates/today_tab.gohtml +++ /dev/null @@ -1,21 +0,0 @@ -{{ define "today_tab" }} - -
-
- {{ if .Data.DailyQuota }} - {{ template "daily_quota" .Data }} -
- {{ end }} - {{ template "meals" .Data }} -
-{{ end }}