Commit 02e39563c8e931c94a650f36d8732beecc068019

Authored by Dmitriy Zaporozhets
1 parent fe7bef3a

better ui for protected branches page

app/views/projects/protected_branches/index.html.haml
@@ -3,13 +3,13 @@ @@ -3,13 +3,13 @@
3 .span3 3 .span3
4 = render "projects/repositories/filter" 4 = render "projects/repositories/filter"
5 .span9 5 .span9
6 - .alert 6 + .alert.alert-info
7 %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. 7 %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}.
8 %p This ability allows: 8 %p This ability allows:
9 %ul 9 %ul
10 %li keep stable branches secured 10 %li keep stable branches secured
11 %li forced code review before merge to protected branches 11 %li forced code review before merge to protected branches
12 - %p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"} 12 + %p Read more about project permissions #{link_to "here", help_permissions_path, class: "underlined_link"}
13 13
14 - if can? current_user, :admin_project, @project 14 - if can? current_user, :admin_project, @project
15 = form_for [@project, @protected_branch] do |f| 15 = form_for [@project, @protected_branch] do |f|
@@ -24,31 +24,30 @@ @@ -24,31 +24,30 @@
24 .span3 24 .span3
25 = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"}) 25 = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"})
26   26  
27 - = f.submit 'Protect', class: "btn-primary btn"  
28 - 27 + = f.submit 'Protect', class: "btn-create btn"
29 - unless @branches.empty? 28 - unless @branches.empty?
30 - %table  
31 - %thead  
32 - %tr  
33 - %th Name  
34 - %th Last commit  
35 - %th  
36 - %tbody  
37 - - @branches.each do |branch|  
38 - %tr  
39 - %td  
40 - = link_to project_commits_path(@project, branch.name) do  
41 - %strong= branch.name  
42 - - if @project.root_ref?(branch.name)  
43 - %span.label default  
44 - %td  
45 - - if branch.commit  
46 - = link_to project_commit_path(@project, branch.commit.id) do  
47 - = truncate branch.commit.id.to_s, length: 10  
48 - = time_ago_in_words(branch.commit.committed_date)  
49 - ago  
50 - - else  
51 - (branch was removed from repository)  
52 - %td 29 + %h5 Already Protected:
  30 + %ul.bordered-list
  31 + - @branches.each do |branch|
  32 + %li
  33 + %h4
  34 + = link_to project_commits_path(@project, branch.name) do
  35 + %strong= branch.name
  36 + - if @project.root_ref?(branch.name)
  37 + %span.label.label-info default
  38 + %span.label.label-success
  39 + %i.icon-lock
  40 + .pull-right
53 - if can? current_user, :admin_project, @project 41 - if can? current_user, :admin_project, @project
54 = link_to 'Unprotect', [@project, branch], confirm: 'Branch will be writable for developers. Are you sure?', method: :delete, class: "btn btn-remove btn-small" 42 = link_to 'Unprotect', [@project, branch], confirm: 'Branch will be writable for developers. Are you sure?', method: :delete, class: "btn btn-remove btn-small"
  43 +
  44 + - if commit = branch.commit
  45 + = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
  46 + = commit.short_id
  47 + %span.light
  48 + = gfm escape_once(truncate(commit.title, length: 40))
  49 + %span
  50 + = time_ago_in_words(commit.committed_date)
  51 + ago
  52 + - else
  53 + (branch was removed from repository)