2023-01-31 14:40:12 +00:00
|
|
|
{{ define "input-field" -}}
|
|
|
|
<div class="input {{ if .Errors }}has-errors{{ end }}">
|
|
|
|
<input type="{{ .Type }}" name="{{ .Name }}" id="{{ .Name }}-field"
|
2023-02-01 10:02:32 +00:00
|
|
|
{{- range $attribute := .Attributes }} {{$attribute.Key}}="{{$attribute.Val}}" {{ end -}}
|
|
|
|
{{ if .Required }}required="required"{{ end }} value="{{ .Value }}" placeholder="{{ .Label }}">
|
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 }}
|
|
|
|
|
|
|
|
{{ define "select-field" -}}
|
|
|
|
<div class="input {{ if .Errors }}has-errors{{ end }}">
|
|
|
|
<select id="{{ .Name }}-field" name="{{ .Name }}">
|
|
|
|
{{- range $option := .Options }}
|
|
|
|
<option value="{{ .Value }}"
|
|
|
|
{{ if eq .Value $.Selected }}selected="selected"{{ end }}>{{ .Label }}</option>
|
|
|
|
{{- end }}
|
|
|
|
</select>
|
|
|
|
<label for="{{ .Name }}-field">{{ .Label }}</label>
|
|
|
|
{{ if .Errors }}
|
|
|
|
<ul>
|
|
|
|
{{- range $error := .Errors }}
|
|
|
|
<li>{{ . }}</li>
|
|
|
|
{{- end }}
|
|
|
|
</ul>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
{{- end }}
|