summaryrefslogtreecommitdiff
path: root/app/views/shared/snippets/_snippet.html.haml
blob: 3acec88c2e31b18d91356f6a713531e6c830db0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
- link_project = local_assigns.fetch(:link_project, false)

%li.snippet-row
  = image_tag avatar_icon_for_user(snippet.author), class: "avatar s40 hidden-xs", alt: ''

  .title
    = link_to reliable_snippet_path(snippet) do
      = snippet.title
    - if snippet.file_name
      %span.snippet-filename.monospace.hidden-xs
        = snippet.file_name

    %ul.controls
      %li
        - note_count = snippet.notes.user.count
        = link_to reliable_snippet_path(snippet, anchor: 'notes'), class: ('no-comments' if note_count.zero?) do
          = icon('comments')
          = note_count
      %li
        %span.sr-only
          = visibility_level_label(snippet.visibility_level)
        = visibility_level_icon(snippet.visibility_level, fw: false)

  .snippet-info
    #{snippet.to_reference} ·
    authored #{time_ago_with_tooltip(snippet.created_at, placement: 'bottom', html_class: 'snippet-created-ago')}
    by
    = link_to user_snippets_path(snippet.author) do
      = snippet.author_name
    - if link_project && snippet.project_id?
      %span.hidden-xs
        in
        = link_to project_path(snippet.project) do
          = snippet.project.full_name

    .pull-right.snippet-updated-at
      %span updated #{time_ago_with_tooltip(snippet.updated_at, placement: 'bottom')}