_note.html.haml 2.47 KB
Newer Older
1 2
- note_editable = note_editable?(note)
%li.timeline-entry{ id: dom_id(note), class: [dom_class(note), "note-row-#{note.id}", ('system-note' if note.system)], data: {author_id: note.author.id, editable: note_editable} }
3 4
  .timeline-entry-inner
    .timeline-icon
5
      %a{href: user_path(note.author)}
6
        = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
7 8
    .timeline-content
      .note-header
9 10
        = link_to_member(note.project, note.author, avatar: false)
        .inline.note-headline-light
11 12 13
          = "#{note.author.to_reference}"
          - if !note.system
            commented
14 15
          %a{ href: "##{dom_id(note)}" }
            = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
16 17 18 19 20
        .note-actions
          - access = note.project.team.human_max_access(note.author.id)
          - if access
            %span.note-role
              = access
21
          - if note_editable
22
            = link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
23 24
              = icon('pencil')
            = 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 js-note-delete danger' do
25
              = icon('trash-o')
26
      .note-body{class: note_editable ? 'js-task-list-container' : ''}
27 28
        .note-text
          = preserve do
29
            = markdown(note.note, pipeline: :note, cache_key: [note, "note"])
30
        - if note_editable
31
          = render 'projects/notes/edit_form', note: note
32
      = edited_time_ago_with_tooltip(note, placement: 'bottom', html_class: 'note_edited_ago', include_author: true)
Jack Weeden's avatar
Jack Weeden committed
33

34 35 36
      - if note.attachment.url
        .note-attachment
          - if note.attachment.image?
Douwe Maan's avatar
Douwe Maan committed
37 38
            = link_to note.attachment.url, target: '_blank' do
              = image_tag note.attachment.url, class: 'note-image-attach'
39
          .attachment
40 41
            = link_to note.attachment.url, target: '_blank' do
              = icon('paperclip')
42
              = note.attachment_identifier
Douwe Maan's avatar
Douwe Maan committed
43
              = link_to delete_attachment_namespace_project_note_path(note.project.namespace, note.project, note),
44 45
                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')