Commit eb7845682d3e9f66694ce6a5a97765fda898a4d2

Authored by Dmitriy Zaporozhets
1 parent 2af8ace1

Improve files/snippets action buttons

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/stylesheets/generic/files.scss
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 20
21 .options { 21 .options {
22 float: right; 22 float: right;
23 - margin-top: -5px; 23 + margin-top: -3px;
24 } 24 }
25 25
26 .left-options { 26 .left-options {
app/assets/stylesheets/sections/tree.scss
@@ -117,15 +117,6 @@ @@ -117,15 +117,6 @@
117 } 117 }
118 } 118 }
119 119
120 -.tree-btn-group {  
121 - top: 2px;  
122 -  
123 - .btn {  
124 - margin-right: 0px;  
125 - padding: 2px 10px;  
126 - }  
127 -}  
128 -  
129 .tree-download-holder .btn { 120 .tree-download-holder .btn {
130 padding: 4px 12px; 121 padding: 4px 12px;
131 } 122 }
app/models/ability.rb
@@ -236,7 +236,11 @@ class Ability @@ -236,7 +236,11 @@ class Ability
236 :"modify_#{name}", 236 :"modify_#{name}",
237 ] 237 ]
238 else 238 else
239 - subject.respond_to?(:project) ? project_abilities(user, subject.project) : [] 239 + if subject.respond_to?(:project)
  240 + project_abilities(user, subject.project)
  241 + else
  242 + []
  243 + end
240 end 244 end
241 end 245 end
242 end 246 end
app/views/projects/blob/_actions.html.haml
@@ -14,6 +14,6 @@ @@ -14,6 +14,6 @@
14 = link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty? 14 = link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty?
15 = link_to "history", project_commits_path(@project, @id), class: "btn btn-small" 15 = link_to "history", project_commits_path(@project, @id), class: "btn btn-small"
16 16
17 - - if allowed_tree_edit?  
18 - = link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do  
19 - remove 17 +- if allowed_tree_edit?
  18 + = link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do
  19 + remove
app/views/projects/snippets/_blob.html.haml
1 .file-holder 1 .file-holder
2 .file-title 2 .file-title
3 %i.icon-file 3 %i.icon-file
4 - %strong= @snippet.file_name  
5 - %span.options  
6 - .btn-group.tree-btn-group.pull-right  
7 - - if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user  
8 - = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet'  
9 - = link_to "Raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" 4 + %span.file_name
  5 + = @snippet.file_name
  6 + .options
  7 + .btn-group
  8 + - if can?(current_user, :modify_project_snippet, @snippet)
  9 + = link_to "edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small", title: 'Edit Snippet'
  10 + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-small", target: "_blank"
  11 + - if can?(current_user, :admin_project_snippet, @snippet)
  12 + = link_to "remove", project_snippet_path(@project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet'
10 = render 'snippets/blob_content' 13 = render 'snippets/blob_content'
app/views/snippets/_blob.html.haml
1 .file-holder 1 .file-holder
2 .file-title 2 .file-title
3 %i.icon-file 3 %i.icon-file
4 - %strong= @snippet.file_name  
5 - %span.options  
6 - .btn-group.tree-btn-group.pull-right  
7 - - if @snippet.author == current_user  
8 - = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet'  
9 - = link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet'  
10 - = link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" 4 + %span.file_name
  5 + = @snippet.file_name
  6 + .options
  7 + .btn-group
  8 + - if can?(current_user, :modify_personal_snippet, @snippet)
  9 + = link_to "edit", edit_snippet_path(@snippet), class: "btn btn-small", title: 'Edit Snippet'
  10 + = link_to "raw", raw_snippet_path(@snippet), class: "btn btn-small", target: "_blank"
  11 + - if can?(current_user, :admin_personal_snippet, @snippet)
  12 + = link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet'
11 = render 'snippets/blob_content' 13 = render 'snippets/blob_content'
app/views/snippets/show.html.haml
@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 private 7 private
8 8
9 .pull-right 9 .pull-right
10 - = link_to new_snippet_path, class: "btn btn-new btn-small", title: "New Snippet" do 10 + = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
11 Add new snippet 11 Add new snippet
12 - 12 +%hr
13 13
14 .append-bottom-20 14 .append-bottom-20
15 .pull-right 15 .pull-right