Commit eb7845682d3e9f66694ce6a5a97765fda898a4d2
1 parent
2af8ace1
Exists in
spb-stable
and in
2 other branches
Improve files/snippets action buttons
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
7 changed files
with
29 additions
and
29 deletions
Show diff stats
app/assets/stylesheets/generic/files.scss
app/assets/stylesheets/sections/tree.scss
app/models/ability.rb
... | ... | @@ -236,7 +236,11 @@ class Ability |
236 | 236 | :"modify_#{name}", |
237 | 237 | ] |
238 | 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 | 244 | end |
241 | 245 | end |
242 | 246 | end | ... | ... |
app/views/projects/blob/_actions.html.haml
... | ... | @@ -14,6 +14,6 @@ |
14 | 14 | = link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty? |
15 | 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 | 1 | .file-holder |
2 | 2 | .file-title |
3 | 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 | 13 | = render 'snippets/blob_content' | ... | ... |
app/views/snippets/_blob.html.haml
1 | 1 | .file-holder |
2 | 2 | .file-title |
3 | 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 | 13 | = render 'snippets/blob_content' | ... | ... |
app/views/snippets/show.html.haml
... | ... | @@ -7,9 +7,9 @@ |
7 | 7 | private |
8 | 8 | |
9 | 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 | 11 | Add new snippet |
12 | - | |
12 | +%hr | |
13 | 13 | |
14 | 14 | .append-bottom-20 |
15 | 15 | .pull-right | ... | ... |