summaryrefslogtreecommitdiff
path: root/app/views/projects/hooks/index.html.haml
blob: ac0db914b10634258aef6442e4c08d2eed059f51 (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
- page_title "Web 钩子"
%h3.page-title
  Web 钩子

%p.light
  #{link_to "Web 钩子", help_page_path("web_hooks", "web_hooks"), class: "vlink"}用于在项目发生相关事件时通知外部服务器。

%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, "链接", 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, "触发", 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 推送事件
          %p.light
            推送仓库时将触发此链接
      %div
        = f.check_box :tag_push_events, class: 'pull-left'
        .prepend-left-20
          = f.label :tag_push_events, class: 'list-label' do
            %strong 标签推送事件
          %p.light
            新标签推送仓库时将触发此链接
      %div
        = f.check_box :note_events, class: 'pull-left'
        .prepend-left-20
          = f.label :note_events, class: 'list-label' do
            %strong 评论
          %p.light
            增加新评论时将触发此链接
      %div
        = f.check_box :issues_events, class: 'pull-left'
        .prepend-left-20
          = f.label :issues_events, class: 'list-label' do
            %strong 问题事件
          %p.light
            问题创建、更新、合并时将触发此链接
      %div
        = f.check_box :merge_requests_events, class: 'pull-left'
        .prepend-left-20
          = f.label :merge_requests_events, class: 'list-label' do
            %strong 合并请求事件
          %p.light
            合并请求创建、更新、合并时将触发此链接
      %div
        = f.check_box :build_events, class: 'pull-left'
        .prepend-left-20
          = f.label :build_events, class: 'list-label' do
            %strong 构建事件
          %p.light
            构建状态改变时将触发此链接
  .form-group
    = f.label :enable_ssl_verification, "SSL 证书验证", class: 'control-label checkbox'
    .col-sm-10
      .checkbox
        = f.label :enable_ssl_verification do
          = f.check_box :enable_ssl_verification
          %strong 开启 SSL 证书验证
  .form-actions
    = f.submit "增加 Web 钩子", class: "btn btn-create"

-if @hooks.any?
  .panel.panel-default
    .panel-heading
      Web 钩子 (#{@hooks.count})
    %ul.well-list
      - @hooks.each do |hook|
        %li
          .pull-right
            = link_to '测试钩子', test_namespace_project_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped"
            = link_to '删除', namespace_project_hook_path(@project.namespace, @project, hook), data: { confirm: '确定要删除么?'}, 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 证书验证:#{hook.enable_ssl_verification ? "已启用" : "已禁用"}