refactor: common base template for pages
will allow to add common header and stuff
This commit is contained in:
@@ -196,7 +196,8 @@ func roomPageRoute(
|
||||
fmt.Printf("all checks for room %s passed with %+v", roomName, session)
|
||||
|
||||
templFile := "templates/room.gohtml"
|
||||
tmpl := template.Must(template.ParseFS(templateFs, templFile))
|
||||
baseFile := "templates/base.gohtml"
|
||||
tmpl := template.Must(template.ParseFS(templateFs, templFile, baseFile))
|
||||
|
||||
type GestureData struct {
|
||||
Name string
|
||||
@@ -210,15 +211,21 @@ func roomPageRoute(
|
||||
})
|
||||
}
|
||||
|
||||
pageData := struct {
|
||||
contentData := struct {
|
||||
Room rooms.Room
|
||||
Gestures []GestureData
|
||||
}{
|
||||
Room: room,
|
||||
Gestures: gesturesData,
|
||||
}
|
||||
data := pageData{
|
||||
Base: baseData{
|
||||
Title: "room-lala-from-base",
|
||||
},
|
||||
Content: contentData,
|
||||
}
|
||||
|
||||
err = tmpl.Execute(w, pageData)
|
||||
err = tmpl.ExecuteTemplate(w, "full-page", data)
|
||||
if err != nil {
|
||||
log.Printf("/room/%s my error in executing template, huh\n %s", roomName, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user