40 lines
711 B
HTML
40 lines
711 B
HTML
{{define "attrs"}}
|
|
name="{{.Name}}"
|
|
placeholder="{{.Placeholder}}"
|
|
aria-invalid="{{not .Valid}}"
|
|
{{if .Error}}
|
|
aria-describedby="{{.Name}}-error"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{define "field"}}
|
|
<mu-field>
|
|
<label>
|
|
{{.Label}}
|
|
{{if eq .Type "textarea"}}
|
|
<textarea
|
|
{{template "attrs" .}}
|
|
>{{.Value}}</textarea>
|
|
{{else}}
|
|
<input
|
|
type="{{.Type}}"
|
|
value="{{.Value}}"
|
|
{{template "attrs" .}}
|
|
>
|
|
{{end}}
|
|
</label>
|
|
{{if .Error}}
|
|
<small id="{{.Name}}-error">{{.Error}}</small>
|
|
{{end}}
|
|
</mu-field>
|
|
{{end}}
|
|
|
|
{{define "form"}}
|
|
<form action="{{.Action}}" method="{{.Method}}">
|
|
{{range .Fields}}
|
|
{{template "field" .}}
|
|
{{end}}
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
{{end}}
|