2016-05-10 18:41:46 -04:00
- return unless note.author
- return if note.cross_reference_not_visible_for?(current_user)
2016-04-15 16:05:37 -04:00
- note_editable = note_editable?(note)
2016-05-10 18:41:46 -04:00
%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} }
2014-08-15 04:14:58 -04:00
.timeline-entry-inner
.timeline-icon
2016-12-26 05:47:16 -05:00
%a{ href: user_path(note.author) }
2015-11-10 10:52:35 -05:00
= image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
2014-08-15 04:14:58 -04:00
.timeline-content
.note-header
2017-02-07 14:34:41 -05:00
%a.visible-xs{ href: user_path(note.author) }
2016-05-10 18:41:46 -04:00
= note.author.to_reference
2017-01-31 08:19:10 -05:00
= link_to_member(note.project, note.author, avatar: false, extra_class: 'hidden-xs')
.note-headline-light
%span.hidden-xs
= note.author.to_reference
2016-05-10 18:41:46 -04:00
- unless note.system
2016-04-20 09:48:53 -04:00
commented
2016-10-08 02:50:28 -04:00
- if note.system
2016-12-22 06:00:09 -05:00
%span.system-note-message
2016-11-21 14:26:47 -05:00
= note.redacted_note_html
2016-03-29 11:25:26 -04:00
%a{ href: "##{dom_id(note)}" }
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
2016-07-26 00:48:15 -04:00
- unless note.system?
.note-actions
- access = note_max_access_for_user(note)
- if access
2017-01-31 08:19:10 -05:00
%span.note-role= access
2016-07-26 00:48:15 -04:00
2016-07-29 06:52:08 -04:00
- if note.resolvable?
2016-09-11 14:09:16 -04:00
- can_resolve = can?(current_user, :resolve_note, note)
2017-02-08 09:58:08 -05:00
%resolve-btn{ "discussion-id" => "#{note.discussion_id}",
2016-07-26 10:47:19 -04:00
":note-id" => note.id,
":resolved" => note.resolved?,
2016-08-01 05:06:31 -04:00
":can-resolve" => can_resolve,
2016-09-21 05:17:27 -04:00
"resolved-by" => "#{note.resolved_by.try(:name)}",
2016-08-01 05:06:31 -04:00
"v-show" => "#{can_resolve || note.resolved?}",
2016-07-26 10:47:19 -04:00
"inline-template" => true,
2016-11-07 05:05:58 -05:00
"ref" => "note_#{note.id}" }
2016-07-26 08:44:51 -04:00
2016-07-26 10:47:19 -04:00
.note-action-button
= icon("spin spinner", "v-show" => "loading")
%button.line-resolve-btn{ type: "button",
2016-08-01 05:06:31 -04:00
class: ("is-disabled" unless can_resolve),
2016-07-26 10:47:19 -04:00
":class" => "{ 'is-active': isResolved }",
":aria-label" => "buttonText",
"@click" => "resolve",
":title" => "buttonText",
"v-show" => "!loading",
2016-11-07 05:05:58 -05:00
":ref" => "'button'" }
2016-07-26 00:48:15 -04:00
2016-08-09 13:49:22 -04:00
= render "shared/icons/icon_status_success.svg"
2016-07-26 00:48:15 -04:00
- if current_user
- if note.emoji_awardable?
= link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
= icon('spinner spin')
2016-08-04 11:53:05 -04:00
= icon('smile-o', class: 'link-highlight')
2016-07-26 00:48:15 -04:00
- if note_editable
= link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
2016-08-04 11:53:05 -04:00
= icon('pencil', class: 'link-highlight')
2017-01-31 08:19:10 -05:00
= 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
2016-10-20 18:35:17 -04:00
= icon('trash-o', class: 'danger-highlight')
2016-12-26 05:47:16 -05:00
.note-body{ class: note_editable ? 'js-task-list-container' : '' }
2016-07-08 20:16:43 -04:00
.note-text.md
2015-07-21 07:59:14 -04:00
= preserve do
2016-10-06 17:52:44 -04:00
= note.redacted_note_html
2016-12-12 14:03:22 -05:00
= edited_time_ago_with_tooltip(note, placement: 'bottom', html_class: 'note_edited_ago', include_author: true)
2016-04-15 16:05:37 -04:00
- if note_editable
2017-01-04 16:44:00 -05:00
.original-note-content.hidden{ data: { post_url: namespace_project_note_path(@project.namespace, @project, note), target_id: note.noteable.id, target_type: note.noteable.class.name.underscore } }
2016-10-13 17:11:43 -04:00
#{note.note}
2017-02-08 04:23:45 -05:00
%textarea.hidden.js-task-list-field.original-task-list{ data: {update_url: namespace_project_note_path(@project.namespace, @project, note) } }= note.note
2016-05-27 11:29:27 -04:00
.note-awards
= render 'award_emoji/awards_block', awardable: note, inline: false
2016-10-08 02:50:28 -04:00
- if note.system
.system-note-commit-list-toggler
Toggle commit list
2017-02-14 21:30:07 -05:00
%i.fa.fa-angle-down
2014-08-15 04:14:58 -04:00
- if note.attachment.url
.note-attachment
- if note.attachment.image?
2015-02-20 09:19:50 -05:00
= link_to note.attachment.url, target: '_blank' do
= image_tag note.attachment.url, class: 'note-image-attach'
2014-11-07 05:51:18 -05:00
.attachment
2015-04-29 16:11:48 -04:00
= link_to note.attachment.url, target: '_blank' do
= icon('paperclip')
2014-08-15 04:14:58 -04:00
= note.attachment_identifier
2015-05-12 06:16:34 -04:00
= link_to delete_attachment_namespace_project_note_path(note.project.namespace, note.project, note),
2015-04-29 16:11:48 -04:00
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')