2015-02-12 01:34:41 +00:00
|
|
|
%h3.page-title
|
|
|
|
= @service.title
|
|
|
|
|
|
|
|
%p #{@service.description} template
|
|
|
|
|
|
|
|
= form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |f|
|
|
|
|
- if @service.errors.any?
|
|
|
|
#error_explanation
|
|
|
|
.alert.alert-danger
|
|
|
|
- @service.errors.full_messages.each do |msg|
|
|
|
|
%p= msg
|
2015-02-13 01:06:55 +00:00
|
|
|
- if @service.help.present?
|
|
|
|
.bs-callout
|
|
|
|
= preserve do
|
|
|
|
= markdown @service.help
|
2015-02-12 01:34:41 +00:00
|
|
|
|
|
|
|
- @service.fields.each do |field|
|
|
|
|
- name = field[:name]
|
2015-02-12 17:19:55 +00:00
|
|
|
- value = @service.send(name) unless field[:type] == 'password'
|
2015-02-12 01:34:41 +00:00
|
|
|
- type = field[:type]
|
|
|
|
- placeholder = field[:placeholder]
|
2015-02-12 17:19:55 +00:00
|
|
|
- choices = field[:choices]
|
|
|
|
- default_choice = field[:default_choice]
|
2015-02-12 01:34:41 +00:00
|
|
|
|
|
|
|
.form-group
|
|
|
|
= f.label name, class: "control-label"
|
|
|
|
.col-sm-10
|
2015-02-12 17:19:55 +00:00
|
|
|
- if type == 'text'
|
|
|
|
= f.text_field name, class: "form-control", placeholder: placeholder
|
|
|
|
- elsif type == 'textarea'
|
|
|
|
= f.text_area name, rows: 5, class: "form-control", placeholder: placeholder
|
|
|
|
- elsif type == 'checkbox'
|
|
|
|
= f.check_box name
|
|
|
|
- elsif type == 'select'
|
|
|
|
= f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
|
|
|
|
- elsif type == 'password'
|
|
|
|
= f.password_field name, class: 'form-control'
|
2015-02-12 01:34:41 +00:00
|
|
|
|
|
|
|
.form-actions
|
|
|
|
= f.submit 'Save', class: 'btn btn-save'
|