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
|
|
|
|
2018-06-07 15:39:30 -04:00
|
|
|
.form-group.row
|
2015-10-01 10:33:05 -04:00
|
|
|
- if type == "password" && value.present?
|
2018-06-07 15:39:30 -04:00
|
|
|
= form.label name, "Enter new #{title.downcase}", class: "col-form-label col-sm-2"
|
2015-10-01 10:33:05 -04:00
|
|
|
- else
|
2018-06-07 15:39:30 -04:00
|
|
|
= form.label name, title, class: "col-form-label col-sm-2"
|
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-10-17 06:46:06 -04:00
|
|
|
= form.password_field name, autocomplete: "new-password", placeholder: placeholder, class: "form-control", required: value.blank? && required, disabled: disabled
|
2015-04-02 04:18:42 -04:00
|
|
|
- if help
|
2018-04-11 14:26:37 -04:00
|
|
|
%span.form-text.text-muted= help
|