Fix rendering
This commit is contained in:
parent
cf950db825
commit
920f162695
|
|
@ -1,5 +1,39 @@
|
|||
{{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}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{{define "page"}}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
@ -23,3 +24,4 @@
|
|||
{{block "BodyAfter" .BodyAfter}}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue