summaryrefslogtreecommitdiff
path: root/templ/form.tpl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templ/form.tpl27
1 files changed, 16 insertions, 11 deletions
diff --git a/templ/form.tpl b/templ/form.tpl
index deb8d58..4d20557 100644
--- a/templ/form.tpl
+++ b/templ/form.tpl
@@ -1,17 +1,22 @@
{{define "formItem"}}
- <label {{with .ID}}for="{{.}}"{{end}}>{{.Label}}</label>
- <input
- {{with .ID}}id="{{.}}"{{end}}
- type="{{.Type}}"
- name="{{.Name}}"
- placeholder="{{.Placeholder}}"
- {{with .Value}}value="{{.}}"{{end}}
- {{with .Class}}class="{{.}}"{{end}}
- {{range .Options}} {{.}} {{end}}
- >
+ {{- $cb := eq .Type "checkbox" -}}
+ <div class="{{if $cb}}form-check form-switch{{else}}form-floating{{end}} mb-3">
+ <input
+ {{with .ID}}id="{{.}}"{{end}}
+ type="{{.Type}}"
+ name="{{.Name}}"
+ placeholder="{{.Placeholder}}"
+ {{with .Value}}value="{{.}}"{{end}}
+ {{with .Class}}class="{{.}}"{{end}}
+ class="{{if $cb}}form-check-input{{else}}form-control{{end}}"
+ {{range .Options}} {{.}} {{end}}
+ >
+ <label {{with .ID}}for="{{.}}"{{end}}
+ {{- if $cb}}class="form-check-label"{{end}}>{{.Label}}</label>
+
{{range errors}}
<p style="color:red">{{.}}</p>
{{end}}
{{with .Footer}}<p>{{.}}</p>{{end}}
- <br />
+ </div>
{{end}} \ No newline at end of file