summaryrefslogtreecommitdiff
path: root/templ/template.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templ/template.go7
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 {