2015-04-02 04:18:42 -04:00
|
|
|
- name = field[:name]
|
|
|
|
- title = field[:title] || name.humanize
|
2015-07-13 07:32:14 -04:00
|
|
|
- value = @service.send(name)
|
2015-04-02 04:18:42 -04:00
|
|
|
- type = field[:type]
|
|
|
|
- placeholder = field[:placeholder]
|
|
|
|
- choices = field[:choices]
|
|
|
|
- default_choice = field[:default_choice]
|
|
|
|
- help = field[:help]
|
|
|
|
|
|
|
|
.form-group
|
2015-10-01 10:33:05 -04:00
|
|
|
- if type == "password" && value.present?
|
|
|
|
= form.label name, "Change #{title}", class: "control-label"
|
|
|
|
- else
|
|
|
|
= form.label name, title, class: "control-label"
|
2015-04-02 04:18:42 -04:00
|
|
|
.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'
|
2015-10-01 10:33:05 -04:00
|
|
|
= form.password_field name, autocomplete: "new-password", class: 'form-control'
|
2015-04-02 04:18:42 -04:00
|
|
|
- if help
|
|
|
|
%span.help-block= help
|