2023-02-11 21:16:48 +00:00
|
|
|
{{ define "hidden-field" -}}
|
2023-02-12 20:06:48 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.InputField*/ -}}
|
|
|
|
<input type="hidden" name="{{ .Name }}"
|
2023-02-11 21:16:48 +00:00
|
|
|
{{- range $attribute := .Attributes }} {{$attribute}} {{ end }}
|
2023-02-12 20:06:48 +00:00
|
|
|
value="{{ .Val }}">
|
2023-02-11 21:16:48 +00:00
|
|
|
{{- end }}
|
|
|
|
|
2023-01-31 14:40:12 +00:00
|
|
|
{{ define "input-field" -}}
|
2023-02-12 20:06:48 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.InputField*/ -}}
|
2023-01-31 14:40:12 +00:00
|
|
|
<div class="input {{ if .Errors }}has-errors{{ end }}">
|
2023-02-07 14:28:22 +00:00
|
|
|
{{ if eq .Type "textarea" }}
|
2023-02-08 12:47:36 +00:00
|
|
|
<textarea name="{{ .Name }}" id="{{ .Name }}-field"
|
2023-02-07 14:28:22 +00:00
|
|
|
{{- range $attribute := .Attributes }} {{$attribute}} {{ end }}
|
2023-02-08 12:47:36 +00:00
|
|
|
{{ if .Required }}required="required"{{ end }} placeholder="{{ .Label }}"
|
|
|
|
>{{ .Val }}</textarea>
|
2023-02-07 14:28:22 +00:00
|
|
|
{{ else }}
|
|
|
|
<input type="{{ .Type }}" name="{{ .Name }}" id="{{ .Name }}-field"
|
|
|
|
{{- range $attribute := .Attributes }} {{$attribute}} {{ end }}
|
|
|
|
{{ if .Required }}required="required"{{ end }} value="{{ .Val }}" placeholder="{{ .Label }}">
|
|
|
|
{{ end }}
|
2023-01-31 14:40:12 +00:00
|
|
|
<label for="{{ .Name }}-field">{{ .Label }}</label>
|
2023-02-01 10:02:32 +00:00
|
|
|
{{- if .Errors }}
|
2023-01-31 14:40:12 +00:00
|
|
|
<ul>
|
|
|
|
{{- range $error := .Errors }}
|
|
|
|
<li>{{ . }}</li>
|
|
|
|
{{- end }}
|
|
|
|
</ul>
|
2023-02-01 10:02:32 +00:00
|
|
|
{{- end }}
|
2023-01-31 14:40:12 +00:00
|
|
|
</div>
|
|
|
|
{{- end }}
|
|
|
|
|
2023-02-12 20:06:48 +00:00
|
|
|
{{ define "hidden-select-field" -}}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.SelectField*/ -}}
|
|
|
|
{{- range $selected := .Selected }}
|
|
|
|
<input type="hidden" name="{{ $.Name }}"
|
|
|
|
{{- range $attribute := $.Attributes }} {{$attribute}} {{ end }}
|
|
|
|
value="{{ . }}">
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-01-31 14:40:12 +00:00
|
|
|
{{ define "select-field" -}}
|
2023-02-12 20:06:48 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.SelectField*/ -}}
|
2023-01-31 14:40:12 +00:00
|
|
|
<div class="input {{ if .Errors }}has-errors{{ end }}">
|
2023-02-01 13:15:02 +00:00
|
|
|
<select id="{{ .Name }}-field" name="{{ .Name }}"
|
2023-02-05 13:06:33 +00:00
|
|
|
{{- range $attribute := .Attributes }} {{$attribute}} {{ end -}}
|
2023-02-08 12:47:36 +00:00
|
|
|
{{ if .Multiple }}multiple="multiple"{{ end }}
|
2023-02-05 13:06:33 +00:00
|
|
|
{{ if .Required }}required="required"{{ end }}
|
2023-02-01 13:15:02 +00:00
|
|
|
>
|
2023-02-05 13:06:33 +00:00
|
|
|
{{- with .EmptyLabel }}
|
|
|
|
<option value="">{{ . }}</option>
|
|
|
|
{{- end}}
|
|
|
|
{{- range $option := .Options }}
|
|
|
|
<option value="{{ .Value }}"
|
2023-02-08 12:47:36 +00:00
|
|
|
{{- if $.IsSelected .Value }} selected="selected"{{ end }}>{{ .Label }}</option>
|
2023-02-05 13:06:33 +00:00
|
|
|
{{- end }}
|
2023-01-31 14:40:12 +00:00
|
|
|
</select>
|
|
|
|
<label for="{{ .Name }}-field">{{ .Label }}</label>
|
2023-02-01 13:15:02 +00:00
|
|
|
{{- if .Errors }}
|
2023-01-31 14:40:12 +00:00
|
|
|
<ul>
|
|
|
|
{{- range $error := .Errors }}
|
|
|
|
<li>{{ . }}</li>
|
|
|
|
{{- end }}
|
|
|
|
</ul>
|
2023-02-01 13:15:02 +00:00
|
|
|
{{- end }}
|
2023-01-31 14:40:12 +00:00
|
|
|
</div>
|
|
|
|
{{- end }}
|