control/info: Setup template inheritance
This commit is contained in:
parent
e5cd57cb7d
commit
dd7be3f520
12 changed files with 768 additions and 758 deletions
|
|
@ -2,6 +2,7 @@ package info
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
|
@ -9,9 +10,22 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
|
||||
)
|
||||
|
||||
//go:embed "html/components.html"
|
||||
//go:embed "html/base.html"
|
||||
var baseTemplateString string
|
||||
var baseTemplate = template.Must(template.New("base.html").Parse(baseTemplateString))
|
||||
|
||||
func base(name string) *template.Template {
|
||||
clone := template.Must(baseTemplate.Clone())
|
||||
clone.Tree.Name = name
|
||||
return clone
|
||||
}
|
||||
|
||||
//go:embed "html/info_components.html"
|
||||
var componentsTemplateString string
|
||||
var componentsTemplate = static.AssetsComponentsIndex.MustParse(componentsTemplateString)
|
||||
var componentsTemplate = static.AssetsComponentsIndex.MustParse(
|
||||
base("info_components.html"),
|
||||
componentsTemplateString,
|
||||
)
|
||||
|
||||
type componentsPageContext struct {
|
||||
Time time.Time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue