Commit 71b7461f authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Reuse system notes helper for profile event icons

parent d4c5dc49
......@@ -39,15 +39,18 @@
fill: $gl-text-color-secondary;
}
&.open-icon svg {
&.opened-icon,
&.created-icon {
svg {
fill: $green-300;
}
}
&.closed-icon svg {
fill: $red-300;
}
&.fork-icon svg {
&.accepted-icon svg {
fill: $blue-300;
}
}
......
module SystemNoteHelper
ICON_NAMES_BY_ACTION = {
'commit' => 'icon_commit',
'push' => 'icon_commit',
'merge' => 'icon_merge',
'merged' => 'icon_merged',
'opened' => 'icon_status_open',
'created' => 'icon_status_open',
'closed' => 'icon_status_closed',
'time_tracking' => 'icon_stopwatch',
'assignee' => 'icon_user',
......@@ -12,15 +14,18 @@ module SystemNoteHelper
'label' => 'icon_tags',
'cross_reference' => 'icon_random',
'branch' => 'icon_code_fork',
'accepted' => 'icon_code_fork',
'confidential' => 'icon_eye_slash',
'visible' => 'icon_eye',
'milestone' => 'icon_clock_o',
'discussion' => 'icon_comment_o',
'moved' => 'icon_arrow_circle_o_right'
'commented on' => 'icon_comment_o',
'moved' => 'icon_arrow_circle_o_right',
'deleted' => 'icon_trash_o'
}.freeze
def icon_for_system_note(note)
icon_name = ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]
icon_name = ICON_NAMES_BY_ACTION[note]
custom_icon(icon_name) if icon_name
end
end
- if current_path?('users#show')
- if event.target
- case event.action_name
- when 'opened'
.system-note-image.open-icon
= custom_icon("icon_status_open")
- when 'closed'
.system-note-image.closed-icon
= custom_icon("icon_status_closed")
- else
.system-note-image.fork-icon
= custom_icon("icon_code_fork")
.system-note-image{ class: "#{event.action_name}-icon" }
= icon_for_system_note(event.action_name)
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
.event-title
%span.author_name= link_to_author event
%span{ class: event.action_name }
......
- if current_path?('users#show')
.system-note-image.open-icon
= custom_icon("icon_status_open")
.system-note-image{ class: "#{event.action_name}-icon" }
= icon_for_system_note(event.action_name)
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
......
- if current_path?('users#show')
.system-note-image
= custom_icon("icon_comment_o")
= icon_for_system_note(event.action_name)
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
......
- project = event.project
- if current_path?('users#show')
.system-note-image
- if event.action_name == "deleted"
= custom_icon("trash_o")
- else
= custom_icon("icon_commit")
= icon_for_system_note(event.data[:event_name])
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
......
......@@ -6,7 +6,7 @@
.timeline-entry-inner
.timeline-icon
- if note.system
= icon_for_system_note(note)
= icon_for_system_note(note.system_note_metadata&.action)
- else
%a{ href: user_path(note.author) }
= image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment