show.html.haml 1.37 KB
Newer Older
Douwe Maan's avatar
Douwe Maan committed
1
- page_title @snippet.title, "Snippet"
2
%h3.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", title: "New Snippet" do
12
      Add new snippet
13
%hr
14
15
16

.append-bottom-20
  .pull-right
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17
18
19
    = "##{@snippet.id}"
    %span.light
      by
20
      = link_to user_snippets_path(@snippet.author) do
21
        = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16", alt: ''
22
        = @snippet.author_name
23
24
25
26

  .back-link
    - if @snippet.author == current_user
      = link_to user_snippets_path(current_user) do
27
        ← your snippets
28
29
30
31
    - else
      = link_to snippets_path do
        ← discover snippets

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
32
33
.file-holder
  .file-title
34
    %i.fa.fa-file
35
    %strong
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
36
      = @snippet.file_name
37
    .file-actions
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
38
39
      .btn-group
        - if can?(current_user, :modify_personal_snippet, @snippet)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
40
41
          = 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
42
      - if can?(current_user, :admin_personal_snippet, @snippet)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
43
        = 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
44
  = render 'shared/snippets/blob'