Refactor Site-Wide Data
This commit is contained in:
parent
b7c55b07f9
commit
e5a5c64953
1 changed files with 5 additions and 3 deletions
8
view.go
8
view.go
|
@ -5,6 +5,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
// "net/http"
|
// "net/http"
|
||||||
|
@ -266,12 +267,13 @@ type LayoutTemplateData struct {
|
||||||
Data any
|
Data any
|
||||||
}
|
}
|
||||||
|
|
||||||
func execTemplate(w http.ResponseWriter, t *template.Template, commonData *NestedCommonTplData, loginData *NestedLoginTplData, config ConfigFile, data any) error {
|
func execTemplate(w http.ResponseWriter, t *template.Template, commonData NestedCommonTplData, loginData NestedLoginTplData, config ConfigFile, data any) error {
|
||||||
commonData.WebsiteURL = config.WebAddress
|
commonData.WebsiteURL = config.WebAddress
|
||||||
commonData.WebsiteName = config.Org
|
commonData.WebsiteName = config.Org
|
||||||
|
log.Printf("execTemplate %v", commonData)
|
||||||
return t.Execute(w, LayoutTemplateData{
|
return t.Execute(w, LayoutTemplateData{
|
||||||
Common: *commonData,
|
Common: commonData,
|
||||||
Login: *loginData,
|
Login: loginData,
|
||||||
Data: data,
|
Data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue