34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
|
{{ define "input-field" -}}
|
||
|
<div class="input {{ if .Errors }}has-errors{{ end }}">
|
||
|
<input type="{{ .Type }}" name="{{ .Name }}" id="{{ .Name }}-field"
|
||
|
{{ if .Required }}required="required"{{ end }} value="{{ .Value }}" placeholder="{{ .Label }}">
|
||
|
<label for="{{ .Name }}-field">{{ .Label }}</label>
|
||
|
{{ if .Errors }}
|
||
|
<ul>
|
||
|
{{- range $error := .Errors }}
|
||
|
<li>{{ . }}</li>
|
||
|
{{- end }}
|
||
|
</ul>
|
||
|
{{ end }}
|
||
|
</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 }}
|