_note.html.haml 3.03 KB
Newer Older
1 2 3
%li.timeline-entry{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
  .timeline-entry-inner
    .timeline-icon
4
      = image_tag avatar_icon(note.author_email), class: "avatar s40"
5 6 7 8
    .timeline-content
      .note-header
        .note-actions
          = link_to "##{dom_id(note)}", name: dom_id(note) do
9
            %i.fa.fa-link
10 11
            Link here
           
12
          - if can?(current_user, :admin_note, note) && note.editable?
13
            = link_to "#", title: "Edit comment", class: "js-note-edit" do
14
              %i.fa.fa-pencil-square-o
15 16 17
              Edit
             
            = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
18
              %i.fa.fa-trash-o.cred
19 20
              Remove
        = link_to_member(@project, note.author, avatar: false)
21 22
        %span.author-username
          = '@' + note.author.username
23 24
        %span.note-last-update
          = note_timestamp(note)
25

26 27
        - if note.upvote?
          %span.vote.upvote.label.label-success
28
            %i.fa.fa-thumbs-up
29 30 31
            \+1
        - if note.downvote?
          %span.vote.downvote.label.label-danger
32
            %i.fa.fa-thumbs-down
33
            \-1
34

35

36
      .note-body
Sacred Seven's avatar
Sacred Seven committed
37
        .note-text{ dir: 'auto' }
38 39
          = preserve do
            = markdown(note.note, {no_header_anchors: true})
Jack Weeden's avatar
Jack Weeden committed
40

41 42
        .note-edit-form
          = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
43
            = render layout: 'projects/md_preview' do
Sacred Seven's avatar
Sacred Seven committed
44
              = f.text_area :note, class: 'note_text js-note-text markdown-area js-gfm-input turn-on', dir: :auto
Jack Weeden's avatar
Jack Weeden committed
45

46 47
            .form-actions.clearfix
              = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
Jack Weeden's avatar
Jack Weeden committed
48

49 50
              .note-form-option
                %a.choose-btn.btn.js-choose-note-attachment-button
51
                  %i.fa.fa-paperclip
52 53 54 55
                  %span Choose File ...
                 
                %span.file_name.js-attachment-filename File name...
                = f.file_field :attachment, class: "js-note-attachment-input hidden"
Jack Weeden's avatar
Jack Weeden committed
56

57
              = link_to  'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
Jack Weeden's avatar
Jack Weeden committed
58 59


60 61 62 63 64
      - if note.attachment.url
        .note-attachment
          - if note.attachment.image?
            = link_to note.attachment.secure_url, target: '_blank' do
              = image_tag note.attachment.secure_url, class: 'note-image-attach'
65
          .attachment
66
            = link_to note.attachment.secure_url, target: "_blank" do
67
              %i.fa.fa-paperclip
68 69 70
              = note.attachment_identifier
              = link_to delete_attachment_project_note_path(@project, note),
                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
71
                %i.fa.fa-trash-o.cred
72
      .clear