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]
|
2017-05-22 06:07:12 -04:00
|
|
|
- required = field[:required]
|
2015-04-02 04:18:42 -04:00
|
|
|
- choices = field[:choices]
|
|
|
|
- default_choice = field[:default_choice]
|
|
|
|
- help = field[:help]
|
2018-01-04 04:33:51 -05:00
|
|
|
- disabled = disable_fields_service?(@service)
|
2015-04-02 04:18:42 -04:00
|
|
|
|
|
|
|
.form-group
|
2015-10-01 10:33:05 -04:00
|
|
|
- if type == "password" && value.present?
|
2017-05-22 03:49:58 -04:00
|
|
|
= form.label name, "Enter new #{title.downcase}", class: "control-label"
|
2015-10-01 10:33:05 -04:00
|
|
|
- else
|
|
|
|
= form.label name, title, class: "control-label"
|
2015-04-02 04:18:42 -04:00
|
|
|
.col-sm-10
|
|
|
|
- if type == 'text'
|
2018-01-04 04:33:51 -05:00
|
|
|
= form.text_field name, class: "form-control", placeholder: placeholder, required: required, disabled: disabled
|
2015-04-02 04:18:42 -04:00
|
|
|
- elsif type == 'textarea'
|
2018-01-04 04:33:51 -05:00
|
|
|
= form.text_area name, rows: 5, class: "form-control", placeholder: placeholder, required: required, disabled: disabled
|
2015-04-02 04:18:42 -04:00
|
|
|
- elsif type == 'checkbox'
|
2018-01-04 04:33:51 -05:00
|
|
|
= form.check_box name, disabled: disabled
|
2015-04-02 04:18:42 -04:00
|
|
|
- elsif type == 'select'
|
2018-01-04 04:33:51 -05:00
|
|
|
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control", disabled: disabled}
|
2015-04-02 04:18:42 -04:00
|
|
|
- elsif type == 'password'
|
2018-01-04 04:33:51 -05:00
|
|
|
= form.password_field name, autocomplete: "new-password", class: "form-control", required: value.blank? && required, disabled: disabled
|
2015-04-02 04:18:42 -04:00
|
|
|
- if help
|
|
|
|
%span.help-block= help
|