mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-19 01:26:08 +10:00
Move protected branches list to a partial.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
- unless @branches.empty?
|
||||
%h5 Already Protected:
|
||||
%table.table.protected-branches-list
|
||||
%thead
|
||||
%tr
|
||||
%th{style: "border:0;"} Branch
|
||||
%th{style: "border:0;"} Developers can push
|
||||
%th{style: "border:0;"}
|
||||
|
||||
%tbody
|
||||
- @branches.each do |branch|
|
||||
- @url = project_protected_branch_path(@project, branch)
|
||||
%tr
|
||||
%td
|
||||
= link_to project_commits_path(@project, branch.name) do
|
||||
%strong= branch.name
|
||||
- if @project.root_ref?(branch.name)
|
||||
%span.label.label-info default
|
||||
%td
|
||||
= check_box_tag "developers_can_push", branch.id, branch.developers_can_push, "data-url" => @url
|
||||
%td
|
||||
.pull-right
|
||||
- if can? current_user, :admin_project, @project
|
||||
= link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small"
|
||||
%tr
|
||||
%td{style: "border:0;"}
|
||||
- if commit = branch.commit
|
||||
= link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
|
||||
= commit.short_id
|
||||
%span.light
|
||||
= gfm escape_once(truncate(commit.title, length: 40))
|
||||
#{time_ago_with_tooltip(commit.committed_date)}
|
||||
- else
|
||||
(branch was removed from repository)
|
||||
%td{style: "border:0;"}
|
||||
%td{style: "border:0;"}
|
||||
@@ -23,39 +23,13 @@
|
||||
.col-sm-10
|
||||
= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2"})
|
||||
.form-group
|
||||
= f.label :developers_can_push, "Developers can push?", class: 'control-label'
|
||||
= f.label :developers_can_push, class: 'control-label' do
|
||||
Developers can push
|
||||
.col-sm-10
|
||||
= f.check_box :developers_can_push
|
||||
.checkbox
|
||||
= f.check_box :developers_can_push
|
||||
%span.descr Allow developers to push to this branch
|
||||
.form-actions
|
||||
= f.submit 'Protect', class: "btn-create btn"
|
||||
- unless @branches.empty?
|
||||
%h5 Already Protected:
|
||||
%ul.bordered-list.protected-branches-list
|
||||
- @branches.each do |branch|
|
||||
%li
|
||||
%h4
|
||||
= link_to project_commits_path(@project, branch.name) do
|
||||
%strong= branch.name
|
||||
- if @project.root_ref?(branch.name)
|
||||
%span.label.label-info default
|
||||
%span.label.label-success
|
||||
%i.fa.fa-lock
|
||||
- if branch.developers_can_push
|
||||
%span.label.label-warning
|
||||
%i.fa.fa-group
|
||||
.pull-right
|
||||
- if can? current_user, :admin_project, @project
|
||||
- if branch.developers_can_push
|
||||
= link_to 'Disable developers push', [@project, branch, { developers_can_push: false }], data: { confirm: 'Branch will be no longer writable for developers. Are you sure?' }, method: :put, class: "btn btn-grouped btn-small"
|
||||
- else
|
||||
= link_to 'Allow developers to push', [@project, branch, { developers_can_push: true }], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :put, class: "btn btn-grouped btn-small"
|
||||
= link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small"
|
||||
= render 'branches_list'
|
||||
|
||||
- if commit = branch.commit
|
||||
= link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
|
||||
= commit.short_id
|
||||
%span.light
|
||||
= gfm escape_once(truncate(commit.title, length: 40))
|
||||
#{time_ago_with_tooltip(commit.committed_date)}
|
||||
- else
|
||||
(branch was removed from repository)
|
||||
|
||||
Reference in New Issue
Block a user