diff --git a/cmd/nourybot/router.go b/cmd/nourybot/router.go
index 61652f6..5c96094 100644
--- a/cmd/nourybot/router.go
+++ b/cmd/nourybot/router.go
@@ -34,7 +34,12 @@ type timersRouteData struct {
}
func (app *application) timersRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
- t, err := template.ParseFiles("./web/templates/timers.page.gohtml")
+ t, err := template.ParseFiles(
+ "./web/templates/base.template.gohtml",
+ "./web/templates/header.partial.gohtml",
+ "./web/templates/footer.partial.gohtml",
+ "./web/templates/timers.page.gohtml",
+ )
if err != nil {
app.Log.Error(err)
return
@@ -79,7 +84,12 @@ type channelTimersRouteData struct {
func (app *application) channelTimersRoute(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
channel := ps.ByName("channel")
- t, err := template.ParseFiles("./web/templates/channeltimers.page.gohtml")
+ t, err := template.ParseFiles(
+ "./web/templates/base.template.gohtml",
+ "./web/templates/header.partial.gohtml",
+ "./web/templates/footer.partial.gohtml",
+ "./web/templates/channeltimers.page.gohtml",
+ )
if err != nil {
app.Log.Error(err)
return
@@ -122,7 +132,12 @@ type commandsRouteData struct {
}
func (app *application) commandsRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
- t, err := template.ParseFiles("./web/templates/commands.page.gohtml")
+ t, err := template.ParseFiles(
+ "./web/templates/base.template.gohtml",
+ "./web/templates/header.partial.gohtml",
+ "./web/templates/footer.partial.gohtml",
+ "./web/templates/commands.page.gohtml",
+ )
if err != nil {
app.Log.Error(err)
return
@@ -203,7 +218,12 @@ type channelCommandsRouteData struct {
func (app *application) channelCommandsRoute(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
channel := ps.ByName("channel")
- t, err := template.ParseFiles("./web/templates/channelcommands.page.gohtml")
+ t, err := template.ParseFiles(
+ "./web/templates/base.template.gohtml",
+ "./web/templates/header.partial.gohtml",
+ "./web/templates/footer.partial.gohtml",
+ "./web/templates/channelcommands.page.gohtml",
+ )
if err != nil {
app.Log.Error(err)
return
diff --git a/web/templates/base.template.gohtml b/web/templates/base.template.gohtml
index 41ebf93..88af319 100644
--- a/web/templates/base.template.gohtml
+++ b/web/templates/base.template.gohtml
@@ -8,7 +8,7 @@
@@ -18,3 +10,4 @@
{{ end }} {{ end }} +{{ end }} diff --git a/web/templates/channeltimers.page.gohtml b/web/templates/channeltimers.page.gohtml index 4bfae84..e9174b4 100644 --- a/web/templates/channeltimers.page.gohtml +++ b/web/templates/channeltimers.page.gohtml @@ -1,13 +1,5 @@ - - - - - -@@ -17,3 +9,4 @@
{{ end }} {{ end }} +{{ end }} diff --git a/web/templates/commands.page.gohtml b/web/templates/commands.page.gohtml index 3ef1d99..ac6c814 100644 --- a/web/templates/commands.page.gohtml +++ b/web/templates/commands.page.gohtml @@ -1,13 +1,5 @@ - - - - - -General commands:
{{ with .Commands }} {{ range . }} @@ -23,3 +15,4 @@ {{ end }} {{ end }} +{{ end }} diff --git a/web/templates/footer.partial.gohtml b/web/templates/footer.partial.gohtml index 7d9aa21..0e772f5 100644 --- a/web/templates/footer.partial.gohtml +++ b/web/templates/footer.partial.gohtml @@ -1,3 +1,3 @@ -{{define "footer"}} -Powered by Go -{{end}} +{{ define "footer" }} +Source: github +{{ end }} diff --git a/web/templates/header.partial.gohtml b/web/templates/header.partial.gohtml index 09c7a13..537071b 100644 --- a/web/templates/header.partial.gohtml +++ b/web/templates/header.partial.gohtml @@ -1,3 +1,3 @@ -{{define "header"}} +{{ define "header" }}Channels connected to:
General commands:
+{{ define "title" }}nourybot - timer {{ end }} +{{ define "body" }} {{ with .Timers }} {{ range . }}@@ -18,3 +9,4 @@
{{ end }} {{ end }} +{{ end }}