diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2014-12-26 17:36:35 +0300 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2014-12-26 17:36:35 +0300 |
commit | 2cbfc515f22e2064fb29c9cbb8326a132a3515fc (patch) | |
tree | 4898792667089bed98cf1de687fd0f09921b75ec /app/views/projects/protected_branches | |
parent | 84af3ceb9bbcbf171f92d01967670bf079012f23 (diff) |
Move protected branches list to a partial.
Diffstat (limited to 'app/views/projects/protected_branches')
-rw-r--r-- | app/views/projects/protected_branches/_branches_list.html.haml | 36 | ||||
-rw-r--r-- | app/views/projects/protected_branches/index.html.haml | 38 |
2 files changed, 42 insertions, 32 deletions
diff --git a/app/views/projects/protected_branches/_branches_list.html.haml b/app/views/projects/protected_branches/_branches_list.html.haml new file mode 100644 index 00000000000..1bae1938c27 --- /dev/null +++ b/app/views/projects/protected_branches/_branches_list.html.haml @@ -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;"} diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml index 183f25bfc82..2164c874c74 100644 --- a/app/views/projects/protected_branches/index.html.haml +++ b/app/views/projects/protected_branches/index.html.haml @@ -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) |