show.html.haml 1.32 KB
Newer Older
Douwe Maan's avatar
Douwe Maan committed
1
- page_title @snippet.title, "Snippets"
2
%h4.page-title
3
4
  = @snippet.title

5
  - if @snippet.private?
6
    %span.label.label-success
7
      %i.fa.fa-lock
8
      private
9

10
  .pull-right
11
    = link_to new_snippet_path, class: "btn btn-new btn-sm", title: "New Snippet" do
12
13
      Add new snippet

14
.append-bottom-10.prepend-top-10.clearfix
15
  .pull-right
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
16
    %span.light
17
18
      = link_to user_snippets_path(@snippet.author) do
        = @snippet.author_name
19
      authored #{time_ago_with_tooltip(@snippet.updated_at)}
20
21
22

  .back-link
    - if @snippet.author == current_user
23
      = link_to dashboard_snippets_path do
24
        ← your snippets
25
    - else
26
      = link_to explore_snippets_path do
27
        ← explore snippets
28

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
29
30
.file-holder
  .file-title
31
    %i.fa.fa-file
32
    %strong
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
33
      = @snippet.file_name
34
    .file-actions
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
35
      .btn-group
36
        - if can?(current_user, :update_personal_snippet, @snippet)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
37
38
          = link_to "edit", edit_snippet_path(@snippet), class: "btn btn-sm", title: 'Edit Snippet'
        = link_to "raw", raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
39
      - if can?(current_user, :admin_personal_snippet, @snippet)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
40
        = link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-sm btn-remove", title: 'Delete Snippet'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
41
  = render 'shared/snippets/blob'