2012-02-15 15:02:33 -05:00
|
|
|
= render "repositories/branches_head"
|
|
|
|
|
2012-04-10 01:51:08 -04:00
|
|
|
.alert
|
2012-08-10 18:07:50 -04:00
|
|
|
%p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}.
|
2012-06-03 18:37:27 -04:00
|
|
|
%p This ability allows:
|
2012-02-15 16:51:04 -05:00
|
|
|
%ul
|
|
|
|
%li keep stable branches secured
|
|
|
|
%li forced code review before merge to protected branches
|
2012-08-10 18:07:50 -04:00
|
|
|
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
|
2012-02-15 15:02:33 -05:00
|
|
|
|
2012-05-17 17:23:18 -04:00
|
|
|
- if can? current_user, :admin_project, @project
|
|
|
|
= form_for [@project, @protected_branch] do |f|
|
|
|
|
-if @protected_branch.errors.any?
|
|
|
|
.alert-message.block-message.error
|
|
|
|
%ul
|
|
|
|
- @protected_branch.errors.full_messages.each do |msg|
|
|
|
|
%li= msg
|
|
|
|
|
|
|
|
.entry.clearfix
|
|
|
|
= f.label :name, "Branch"
|
|
|
|
.span3
|
2012-08-10 18:07:50 -04:00
|
|
|
= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , { include_blank: "-- Select branch" }, { class: "span3" })
|
2012-05-17 17:23:18 -04:00
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
= f.submit 'Protect', class: "primary btn"
|
2012-02-15 15:02:33 -05:00
|
|
|
|
|
|
|
- unless @branches.empty?
|
2012-05-17 17:23:18 -04:00
|
|
|
%table.admin-table
|
2012-02-15 15:02:33 -05:00
|
|
|
%thead
|
|
|
|
%tr
|
|
|
|
%th Name
|
|
|
|
%th Last commit
|
2012-02-15 16:51:04 -05:00
|
|
|
%th
|
2012-02-15 15:02:33 -05:00
|
|
|
%tbody
|
|
|
|
- @branches.each do |branch|
|
|
|
|
%tr
|
|
|
|
%td
|
2012-08-10 18:07:50 -04:00
|
|
|
= link_to project_commits_path(@project, ref: branch.name) do
|
2012-02-15 15:02:33 -05:00
|
|
|
%strong= branch.name
|
|
|
|
- if branch.name == @project.root_ref
|
|
|
|
%span.label default
|
|
|
|
%td
|
2012-08-08 10:08:43 -04:00
|
|
|
= link_to project_commit_path(@project, branch.commit.id) do
|
2012-08-10 18:07:50 -04:00
|
|
|
= truncate branch.commit.id.to_s, length: 10
|
2012-02-15 15:02:33 -05:00
|
|
|
= time_ago_in_words(branch.commit.committed_date)
|
|
|
|
ago
|
2012-02-15 16:51:04 -05:00
|
|
|
%td
|
|
|
|
- if can? current_user, :admin_project, @project
|
2012-08-10 18:07:50 -04:00
|
|
|
= link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "danger btn small"
|
2012-02-15 16:51:04 -05:00
|
|
|
|
2012-02-15 15:02:33 -05:00
|
|
|
:javascript
|
|
|
|
$('select#protected_branch_name').chosen();
|