Commit 9bccb4c9 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'protected-branches-ui' into 'master'

Protected branches UI

![Screen_Shot_2016-04-26_at_15.50.10](/uploads/4b905db031aab412bc01616e0be36c1b/Screen_Shot_2016-04-26_at_15.50.10.png)

![Screen_Shot_2016-04-26_at_15.50.00](/uploads/b09229b364ec5361fce375299d39d99c/Screen_Shot_2016-04-26_at_15.50.00.png)

Closes #14027

See merge request !3929
parents 14c2c573 a3d6b610
...@@ -279,12 +279,6 @@ a.deploy-project-label { ...@@ -279,12 +279,6 @@ a.deploy-project-label {
} }
} }
table.table.protected-branches-list tr.no-border {
th, td {
border: 0;
}
}
.project-import .btn { .project-import .btn {
float: left; float: left;
margin-right: 10px; margin-right: 10px;
...@@ -497,3 +491,14 @@ pre.light-well { ...@@ -497,3 +491,14 @@ pre.light-well {
color: #fff; color: #fff;
} }
} }
.protected-branches-list {
a {
color: $gl-gray;
font-weight: 600;
&:hover {
color: $gl-link-color;
}
}
}
- unless @branches.empty? %h5.prepend-top-0
%br Already Protected (#{@branches.size})
%h4 Already Protected: - if @branches.empty?
.table-holder %p.profile-settings-message.text-center
No branches are protected, protect a branch with the form above.
- else
- can_admin_project = can?(current_user, :admin_project, @project)
.table-responsive
%table.table.protected-branches-list %table.table.protected-branches-list
%colgroup
%col{ width: "30%" }
%col{ width: "30%" }
%col{ width: "25%" }
- if can_admin_project
%col
%thead %thead
%tr.no-border %tr
%th Branch %th Branch
%th Developers can push
%th Last commit %th Last commit
%th Developers can push
- if can_admin_project
%th %th
%tbody %tbody
- @branches.each do |branch| - @branches.each do |branch|
- @url = namespace_project_protected_branch_path(@project.namespace, @project, branch) - @url = namespace_project_protected_branch_path(@project.namespace, @project, branch)
%tr %tr
%td %td
= link_to namespace_project_commits_path(@project.namespace, @project, branch.name) do = link_to(branch.name, namespace_project_commits_path(@project.namespace, @project, branch.name))
%strong= branch.name
- if @project.root_ref?(branch.name) - if @project.root_ref?(branch.name)
%span.label.label-info default %span.label.label-info.prepend-left-5 default
%td
= check_box_tag "developers_can_push", branch.id, branch.developers_can_push, "data-url" => @url
%td %td
- if commit = branch.commit - if commit = branch.commit
= link_to namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id' do = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id')
= commit.short_id
·
#{time_ago_with_tooltip(commit.committed_date)} #{time_ago_with_tooltip(commit.committed_date)}
- else - else
(branch was removed from repository) (branch was removed from repository)
%td %td
.pull-right = check_box_tag("developers_can_push", branch.id, branch.developers_can_push, data: { url: @url })
- if can? current_user, :admin_project, @project - if can_admin_project
= link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-sm" %td
= link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-warning btn-sm"
- page_title "Protected branches" - page_title "Protected branches"
%h3.page-title Protected branches
%p.light Keep stable branches secure and force developers to use Merge Requests
%hr
.well .row.prepend-top-default.append-bottom-default
%p Protected branches are designed to .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 %ul
%li prevent pushes from everybody except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"} %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 force pushing to the branch
%li prevent anyone from deleting the branch %li prevent anyone from deleting the branch
%p Read more about #{link_to "project permissions", help_page_path("permissions", "permissions"), class: "underlined-link"} %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
- if can? current_user, :admin_project, @project = form_for [@project.namespace.becomes(Namespace), @project, @protected_branch] do |f|
= form_for [@project.namespace.becomes(Namespace), @project, @protected_branch], html: { class: 'form-horizontal' } do |f|
= form_errors(@protected_branch) = form_errors(@protected_branch)
.form-group .form-group
= f.label :name, "Branch", class: 'control-label' = f.label :name, "Branch", class: "label-light"
.col-sm-10
= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: true}, {class: "select2", data: {placeholder: "Select branch"}}) = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: true}, {class: "select2", data: {placeholder: "Select branch"}})
.form-group .form-group
.col-sm-offset-2.col-sm-10 = f.check_box :developers_can_push, class: "pull-left"
.checkbox .prepend-left-20
= f.label :developers_can_push do = f.label :developers_can_push, "Developers can push", class: "label-light append-bottom-0"
= f.check_box :developers_can_push %p.light.append-bottom-0
%strong Developers can push Allow developers to push to this branch
.help-block Allow developers to push to this branch = f.submit "Protect", class: "btn-create btn"
.form-actions %hr
= f.submit 'Protect', class: "btn-create btn" = render "branches_list"
= render 'branches_list'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment