Refactor Site-Wide Data

This commit is contained in:
Chris Mann 2023-07-27 15:46:05 +02:00
parent b7c55b07f9
commit e5a5c64953

View file

@ -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,
}) })
} }