summaryrefslogtreecommitdiff
path: root/app/views/projects/protected_branches/index.html.haml
blob: 8eaef1f2904abf8c1722ca98fc73c097c2f8e6af (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
- page_title "Protected branches"

.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
      = page_title
    %p Keep stable branches secure and force developers to use Merge Requests
  .col-lg-9
    %h5.prepend-top-0
      Protect a branch
    .account-well.append-bottom-default
      %p.light-header.append-bottom-0 Protected branches are designed to
      %ul
        %li prevent pushes from everybody except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}
        %li prevent anyone from force pushing to the branch
        %li prevent anyone from deleting the branch
      %p.append-bottom-0 Read more about #{link_to "project permissions", help_page_path("permissions", "permissions"), class: "underlined-link"}
    - if can? current_user, :admin_project, @project
      = form_for [@project.namespace.becomes(Namespace), @project, @protected_branch] do |f|
        = form_errors(@protected_branch)

        .form-group
          = f.label :name, "Branch", class: "label-light"
          = f.text_field(:name)
          %p.help-block
            Wildcards such as
            %code *-stable
            or
            %code production/*
            are supported.

        .form-group
          = f.check_box :developers_can_push, class: "pull-left"
          .prepend-left-20
            = f.label :developers_can_push, "Developers can push", class: "label-light append-bottom-0"
            %p.light.append-bottom-0
              Allow developers to push to this branch
        = f.submit "Protect", class: "btn-create btn"
    %hr
    = render "branches_list"

:javascript
  $("#protected_branch_name").select2({
    placeholder: "Select branch",
    createSearchChoice: function(term) { return { id: term, text: term }; },
    data: gon.open_branches
  })