diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-02-11 23:45:56 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-02-11 23:45:56 +0100 |
commit | 934df3f098c33bcbb1493a420833817b80518020 (patch) | |
tree | f2fa5d6356bc32b84c6f19377ca106c627f4132b /templ/template.go | |
parent | 09cb0762553494f2e31f4a7dc60c0c4ba09e91a1 (diff) | |
download | gosten-934df3f098c33bcbb1493a420833817b80518020.tar.gz gosten-934df3f098c33bcbb1493a420833817b80518020.tar.bz2 gosten-934df3f098c33bcbb1493a420833817b80518020.zip |
Include form handling
Diffstat (limited to 'templ/template.go')
-rw-r--r-- | templ/template.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/templ/template.go b/templ/template.go index 8fed965..20a4de7 100644 --- a/templ/template.go +++ b/templ/template.go @@ -4,6 +4,8 @@ import ( "embed" "html/template" "sync" + + "github.com/Necoro/form" ) //go:embed *.tpl @@ -13,9 +15,12 @@ var templates = make(map[string]*template.Template) var muTpl sync.RWMutex var baseTpl *template.Template +var formBuilder form.Builder func init() { - baseTpl = template.Must(template.ParseFS(fs, "base.tpl")) + baseTpl = template.Must(template.ParseFS(fs, "base.tpl", "form.tpl")) + formBuilder = form.Builder{InputTemplate: baseTpl.Lookup("formItem")} + baseTpl.Funcs(formBuilder.FuncMap()) } func Lookup(name string) *template.Template { |