From b2447bc967df37b31282a97e32c581954bb8bcc9 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 17 Oct 2024 16:37:23 +0200 Subject: Move from html/template to templ --- form/field.templ | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 form/field.templ (limited to 'form/field.templ') diff --git a/form/field.templ b/form/field.templ new file mode 100644 index 0000000..e9ce33e --- /dev/null +++ b/form/field.templ @@ -0,0 +1,42 @@ +package form + +import "fmt" + +func (f *field) isCheckbox() bool { + return f.Type == "checkbox" +} + +func (f *field) optionAttributes() templ.Attributes { + attrs := make(map[string]any) + for _, o := range f.Options { + attrs[o] = true + } + return templ.Attributes(attrs) +} + +templ (f *field) item(errors []string) { +
+ + + for _, e := range errors { +

{e}

+ } +
+} \ No newline at end of file -- cgit v1.2.3-70-g09d2