BigW Consortium Gitlab

_field.html.haml 1 KB
Newer Older
1 2
- name = field[:name]
- title = field[:title] || name.humanize
3
- value = @service.send(name)
4 5 6 7 8 9 10
- type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]

.form-group
11 12 13 14
  - if type == "password" && value.present?
    = form.label name, "Change #{title}", class: "control-label"
  - else
    = form.label name, title, class: "control-label"
15 16 17 18 19 20 21 22 23 24
  .col-sm-10
    - if type == 'text'
      = form.text_field name, class: "form-control", placeholder: placeholder
    - elsif type == 'textarea'
      = form.text_area name, rows: 5, class: "form-control", placeholder: placeholder
    - elsif type == 'checkbox'
      = form.check_box name
    - elsif type == 'select'
      = form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
    - elsif type == 'password'
25
      = form.password_field name, autocomplete: "new-password", class: 'form-control'
26 27
    - if help
      %span.help-block= help