BigW Consortium Gitlab

_actions.html.haml 1.54 KB
Newer Older
1 2
- return unless current_user

Phil Hughes committed
3
.hidden-xs
4
  - if can?(current_user, :update_personal_snippet, @snippet)
5
    = link_to edit_snippet_path(@snippet), class: "btn btn-grouped" do
6
      Edit
7
  - if can?(current_user, :admin_personal_snippet, @snippet)
8
    = link_to snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-inverted btn-remove", title: 'Delete Snippet' do
9
      Delete
10 11
  = link_to new_snippet_path, class: "btn btn-grouped btn-inverted btn-create", title: "New snippet" do
    New snippet
12
  - if @snippet.submittable_as_spam_by?(current_user)
13
    = link_to 'Submit as spam', mark_as_spam_snippet_path(@snippet), method: :post, class: 'btn btn-grouped btn-spam', title: 'Submit as spam'
14 15 16 17 18 19 20 21 22 23
.visible-xs-block.dropdown
  %button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } }
    Options
    = icon('caret-down')
  .dropdown-menu.dropdown-menu-full-width
    %ul
      %li
        = link_to new_snippet_path, title: "New snippet" do
          New snippet
      - if can?(current_user, :admin_personal_snippet, @snippet)
Phil Hughes committed
24
        %li
25 26 27 28 29 30
          = link_to snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, title: 'Delete Snippet' do
            Delete
      - if can?(current_user, :update_personal_snippet, @snippet)
        %li
          = link_to edit_snippet_path(@snippet) do
            Edit
31
      - if @snippet.submittable_as_spam_by?(current_user)
32 33
        %li
          = link_to 'Submit as spam', mark_as_spam_snippet_path(@snippet), method: :post