summaryrefslogtreecommitdiff
path: root/app/views/projects/hooks/index.html.haml
blob: 67d016bd871015f2c414e03eea5ea413c19a92f6 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
- page_title "Webhooks"
%h3.page-title
  Webhooks

%p.light
  #{link_to "Webhooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be
  used for binding events when something is happening within the project.

%hr.clearfix

= form_for [@project.namespace.becomes(Namespace), @project, @hook], as: :hook, url: namespace_project_hooks_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f|
  -if @hook.errors.any?
    .alert.alert-danger
      - @hook.errors.full_messages.each do |msg|
        %p= msg
  .form-group
    = f.label :url, "URL", class: 'control-label'
    .col-sm-10
      = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
  .form-group
    = f.label :url, "Trigger", class: 'control-label'
    .col-sm-10.prepend-top-10
      %div
        = f.check_box :push_events, class: 'pull-left'
        .prepend-left-20
          = f.label :push_events, class: 'list-label' do
            %strong Push events
          %p.light
            This url will be triggered by a push to the repository
      %div
        = f.check_box :tag_push_events, class: 'pull-left'
        .prepend-left-20
          = f.label :tag_push_events, class: 'list-label' do
            %strong Tag push events
          %p.light
            This url will be triggered when a new tag is pushed to the repository
      %div
        = f.check_box :note_events, class: 'pull-left'
        .prepend-left-20
          = f.label :note_events, class: 'list-label' do
            %strong Comments
          %p.light
            This url will be triggered when someone adds a comment
      %div
        = f.check_box :issues_events, class: 'pull-left'
        .prepend-left-20
          = f.label :issues_events, class: 'list-label' do
            %strong Issues events
          %p.light
            This url will be triggered when an issue is created/updated/merged
      %div
        = f.check_box :merge_requests_events, class: 'pull-left'
        .prepend-left-20
          = f.label :merge_requests_events, class: 'list-label' do
            %strong Merge Request events
          %p.light
            This url will be triggered when a merge request is created/updated/merged
      %div
        = f.check_box :build_events, class: 'pull-left'
        .prepend-left-20
          = f.label :build_events, class: 'list-label' do
            %strong Build events
          %p.light
            This url will be triggered when the build status changes
  .form-group
    = f.label :enable_ssl_verification, "SSL verification", class: 'control-label checkbox'
    .col-sm-10
      .checkbox
        = f.label :enable_ssl_verification do
          = f.check_box :enable_ssl_verification
          %strong Enable SSL verification
  .form-actions
    = f.submit "Add Webhook", class: "btn btn-create"

-if @hooks.any?
  .panel.panel-default
    .panel-heading
      Webhooks (#{@hooks.count})
    %ul.well-list
      - @hooks.each do |hook|
        %li
          .pull-right
            = link_to 'Test Hook', test_namespace_project_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped"
            = link_to 'Remove', namespace_project_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped"
          .clearfix
            %span.monospace= hook.url
          %p
            - %w(push_events tag_push_events issues_events note_events merge_requests_events build_events).each do |trigger|
              - if hook.send(trigger)
                %span.label.label-gray= trigger.titleize
            SSL Verification: #{hook.enable_ssl_verification ? "enabled" : "disabled"}