_note.html.haml 3.5 KB
Newer Older
D
Douwe Maan 已提交
1 2 3
- return unless note.author
- return if note.cross_reference_not_visible_for?(current_user)

4
- note_editable = note_editable?(note)
D
Douwe Maan 已提交
5
%li.timeline-entry{ id: dom_id(note), class: ["note", "note-row-#{note.id}", ('system-note' if note.system)], data: {author_id: note.author.id, editable: note_editable} }
6 7
  .timeline-entry-inner
    .timeline-icon
8
      %a{href: user_path(note.author)}
9
        = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
10 11
    .timeline-content
      .note-header
12 13
        = link_to_member(note.project, note.author, avatar: false)
        .inline.note-headline-light
D
Douwe Maan 已提交
14 15
          = note.author.to_reference
          - unless note.system
16
            commented
17 18
          %a{ href: "##{dom_id(note)}" }
            = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
19
        .note-actions
20
          - access = note_max_access_for_user(note)
21
          - if access and not note.system
22
            %span.note-role.hidden-xs= access
23
          - if !note.system && note.new_diff_note? && current_user
24
            %resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'", ":discussion-id" => "'#{note.discussion_id}'", ":note-id" => note.id, ":resolved" => "false", "inline-template" => true, "v-ref:note_#{note.id}" => true }
25 26 27 28
              .note-action-button
                = icon("spin spinner", "v-show" => "loading")
                %button.line-resolve-btn{ type: "button", ":class" => "{ 'is-active': isResolved }", ":aria-label" => "buttonText", "@click" => "resolve", ":title" => "buttonText", "v-show" => "!loading", "v-el:button" => true }
                  = icon("check")
29
          - if current_user and not note.system
F
Fatih Acet 已提交
30
            = link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
F
Fatih Acet 已提交
31 32
              = icon('spinner spin')
              = icon('smile-o')
33
          - if note_editable
34
            = link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
A
Annabel Dunstone 已提交
35
              = icon('pencil')
36
            = link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do
D
Douwe Maan 已提交
37
              = icon('trash-o')
38
      .note-body{class: note_editable ? 'js-task-list-container' : ''}
39
        .note-text.md
H
Hannes Rosenögger 已提交
40
          = preserve do
41
            = note.note_html
F
Fatih Acet 已提交
42
          = edited_time_ago_with_tooltip(note, placement: 'bottom', html_class: 'note_edited_ago', include_author: true)
43
        - if note_editable
44
          = render 'projects/notes/edit_form', note: note
45 46
        .note-awards
          = render 'award_emoji/awards_block', awardable: note, inline: false
J
Jack Weeden 已提交
47

48 49 50
      - if note.attachment.url
        .note-attachment
          - if note.attachment.image?
D
Douwe Maan 已提交
51 52
            = link_to note.attachment.url, target: '_blank' do
              = image_tag note.attachment.url, class: 'note-image-attach'
53
          .attachment
54 55
            = link_to note.attachment.url, target: '_blank' do
              = icon('paperclip')
56
              = note.attachment_identifier
D
Douwe Maan 已提交
57
              = link_to delete_attachment_namespace_project_note_path(note.project.namespace, note.project, note),
58 59
                title: 'Delete this attachment', method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: 'danger js-note-attachment-delete' do
                = icon('trash-o', class: 'cred')