debian-mirror-gitlab/app/views/shared/_field.html.haml

30 lines
1.3 KiB
Text
Raw Normal View History

2015-09-11 14:41:01 +05:30
- name = field[:name]
- title = field[:title] || name.humanize
- value = @service.send(name)
- type = field[:type]
- placeholder = field[:placeholder]
2017-09-10 17:25:29 +05:30
- required = field[:required]
2015-09-11 14:41:01 +05:30
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]
2018-03-17 18:26:18 +05:30
- disabled = disable_fields_service?(@service)
2015-09-11 14:41:01 +05:30
.form-group
2015-10-24 18:46:33 +05:30
- if type == "password" && value.present?
2017-09-10 17:25:29 +05:30
= form.label name, "Enter new #{title.downcase}", class: "control-label"
2015-10-24 18:46:33 +05:30
- else
= form.label name, title, class: "control-label"
2015-09-11 14:41:01 +05:30
.col-sm-10
- if type == 'text'
2018-03-17 18:26:18 +05:30
= form.text_field name, class: "form-control", placeholder: placeholder, required: required, disabled: disabled
2015-09-11 14:41:01 +05:30
- elsif type == 'textarea'
2018-03-17 18:26:18 +05:30
= form.text_area name, rows: 5, class: "form-control", placeholder: placeholder, required: required, disabled: disabled
2015-09-11 14:41:01 +05:30
- elsif type == 'checkbox'
2018-03-17 18:26:18 +05:30
= form.check_box name, disabled: disabled
2015-09-11 14:41:01 +05:30
- elsif type == 'select'
2018-03-17 18:26:18 +05:30
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control", disabled: disabled}
2015-09-11 14:41:01 +05:30
- elsif type == 'password'
2018-03-17 18:26:18 +05:30
= form.password_field name, autocomplete: "new-password", class: "form-control", required: value.blank? && required, disabled: disabled
2015-09-11 14:41:01 +05:30
- if help
%span.help-block= help