ProtectedBranches model, Master permission for repo\n Allow push to protected branch for masters only
This commit is contained in:
parent
3a9e5a9357
commit
37224dc9c1
14 changed files with 229 additions and 53 deletions
39
app/views/protected_branches/index.html.haml
Normal file
39
app/views/protected_branches/index.html.haml
Normal file
|
@ -0,0 +1,39 @@
|
|||
= render "repositories/branches_head"
|
||||
|
||||
= 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
|
||||
|
||||
.clearfix
|
||||
= f.label :name
|
||||
.input= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , { :include_blank => "Select branch" }, { :style => "width:300px" })
|
||||
.actions
|
||||
= f.submit 'Add', :class => "primary btn"
|
||||
|
||||
|
||||
- unless @branches.empty?
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Last commit
|
||||
%tbody
|
||||
- @branches.each do |branch|
|
||||
%tr
|
||||
%td
|
||||
= link_to project_commits_path(@project, :ref => branch.name) do
|
||||
%strong= branch.name
|
||||
- if branch.name == @project.root_ref
|
||||
%span.label default
|
||||
%td
|
||||
= link_to project_commits_path(@project, branch.commit.id) do
|
||||
= truncate branch.commit.id.to_s, :length => 10
|
||||
= time_ago_in_words(branch.commit.committed_date)
|
||||
ago
|
||||
|
||||
|
||||
:javascript
|
||||
$('select#protected_branch_name').chosen();
|
9
app/views/repositories/_branches_head.html.haml
Normal file
9
app/views/repositories/_branches_head.html.haml
Normal file
|
@ -0,0 +1,9 @@
|
|||
= render "repositories/head"
|
||||
%ul.pills
|
||||
%li{:class => ("active" if current_page?(branches_project_repository_path(@project)))}
|
||||
= link_to branches_project_repository_path(@project) do
|
||||
All
|
||||
%li{:class => ("active" if current_page?(project_protected_branches_path(@project)))}
|
||||
= link_to project_protected_branches_path(@project) do
|
||||
Protected
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
= link_to project_repository_path(@project) do
|
||||
%span
|
||||
Activities
|
||||
%li{:class => "#{'active' if current_page?(branches_project_repository_path(@project)) }"}
|
||||
%li{:class => "#{'active' if current_page?(branches_project_repository_path(@project)) || current_page?(project_protected_branches_path(@project)) }"}
|
||||
= link_to branches_project_repository_path(@project) do
|
||||
%span
|
||||
Branches
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= render "head"
|
||||
= render "repositories/branches_head"
|
||||
- unless @branches.empty?
|
||||
%table
|
||||
%thead
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue