debian-mirror-gitlab/app/views/projects/services/_form.html.haml
2014-09-02 14:37:02 +02:00

48 lines
1.4 KiB
Text

%h3.page-title
= @service.title
= boolean_to_icon @service.activated?
%p= @service.description
.back-link
= link_to project_services_path(@project) do
← to services
%hr
= form_for(@service, as: :service, url: project_service_path(@project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |f|
- if @service.errors.any?
.alert.alert-danger
%ul
- @service.errors.full_messages.each do |msg|
%li= msg
- if @service.help.present?
.bs-callout
= @service.help
.form-group
= f.label :active, "Active", class: "control-label"
.col-sm-10
= f.check_box :active
- @service.fields.each do |field|
- name = field[:name]
- type = field[:type]
- placeholder = field[:placeholder]
.form-group
= f.label name, class: "control-label"
.col-sm-10
- 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
.form-actions
= f.submit 'Save', class: 'btn btn-save'
 
- if @service.valid? && @service.activated? && @service.can_test?
= link_to 'Test settings', test_project_service_path(@project, @service.to_param), class: 'btn'