Commit eb784568 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve files/snippets action buttons

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2af8ace1
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
.options { .options {
float: right; float: right;
margin-top: -5px; margin-top: -3px;
} }
.left-options { .left-options {
......
...@@ -117,15 +117,6 @@ ...@@ -117,15 +117,6 @@
} }
} }
.tree-btn-group {
top: 2px;
.btn {
margin-right: 0px;
padding: 2px 10px;
}
}
.tree-download-holder .btn { .tree-download-holder .btn {
padding: 4px 12px; padding: 4px 12px;
} }
......
...@@ -236,7 +236,11 @@ class Ability ...@@ -236,7 +236,11 @@ class Ability
:"modify_#{name}", :"modify_#{name}",
] ]
else else
subject.respond_to?(:project) ? project_abilities(user, subject.project) : [] if subject.respond_to?(:project)
project_abilities(user, subject.project)
else
[]
end
end end
end end
end end
......
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
= link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty? = link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty?
= link_to "history", project_commits_path(@project, @id), class: "btn btn-small" = link_to "history", project_commits_path(@project, @id), class: "btn btn-small"
- if allowed_tree_edit? - if allowed_tree_edit?
= link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do = link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do
remove remove
.file-holder .file-holder
.file-title .file-title
%i.icon-file %i.icon-file
%strong= @snippet.file_name %span.file_name
%span.options = @snippet.file_name
.btn-group.tree-btn-group.pull-right .options
- if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user .btn-group
= link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet' - if can?(current_user, :modify_project_snippet, @snippet)
= link_to "Raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" = link_to "edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small", title: 'Edit Snippet'
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-small", target: "_blank"
- if can?(current_user, :admin_project_snippet, @snippet)
= link_to "remove", project_snippet_path(@project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet'
= render 'snippets/blob_content' = render 'snippets/blob_content'
.file-holder .file-holder
.file-title .file-title
%i.icon-file %i.icon-file
%strong= @snippet.file_name %span.file_name
%span.options = @snippet.file_name
.btn-group.tree-btn-group.pull-right .options
- if @snippet.author == current_user .btn-group
= link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet' - if can?(current_user, :modify_personal_snippet, @snippet)
= link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet' = link_to "edit", edit_snippet_path(@snippet), class: "btn btn-small", title: 'Edit Snippet'
= link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" = link_to "raw", raw_snippet_path(@snippet), class: "btn btn-small", target: "_blank"
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet'
= render 'snippets/blob_content' = render 'snippets/blob_content'
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
private private
.pull-right .pull-right
= link_to new_snippet_path, class: "btn btn-new btn-small", title: "New Snippet" do = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
Add new snippet Add new snippet
%hr
.append-bottom-20 .append-bottom-20
.pull-right .pull-right
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment