summaryrefslogtreecommitdiff
path: root/app/views/projects/services/_form.html.haml
blob: 202bf3272176e3aa88ed6afe6755d338012e51b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
%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) do |f|
  - if @service.errors.any?
    .alert.alert-error
      %ul
        - @service.errors.full_messages.each do |msg|
          %li= msg


  .control-group
    = f.label :active, "Active", class: "control-label"
    .controls
      = f.check_box :active

  - @service.fields.each do |field|
    - name = field[:name]
    - type = field[:type]
    - placeholder = field[:placeholder]

    .control-group
      = f.label name, class: "control-label"
      .controls
        - if type == 'text'
          = f.text_field name, class: "input-xlarge", 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 btn-small'