You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
772B

  1. {{ $permitted_attrs := .permitted_attrs }}
  2. {{ $boolean_attrs := .boolean_attrs }}
  3. {{ $validations := .validations }}
  4. {{ range $name, $value := .attrs }}
  5. {{ if and (ne $value nil) (in $permitted_attrs $name) }}
  6. {{ if ne "class" $name }}
  7. {{ if in $boolean_attrs $name }}
  8. {{ if eq $value "true" }}{{ $name }}{{ end }}
  9. {{ else if index $validations $name }}
  10. {{ if in (index $validations $name) $value }}
  11. {{ $name }}="{{ $value }}"
  12. {{ end }}
  13. {{ else }}
  14. {{ if eq $name "id" }}
  15. {{ $name }}="{{- $value | urlize -}}"
  16. {{ else }}
  17. {{ $name }}="{{ $value }}"
  18. {{ end }}
  19. {{ end }}
  20. {{ end }}
  21. {{ end }}
  22. {{ end }}
  23. class="form-control{{ with .attrs.class }} {{ . }}{{ end }}"