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 @@ ...@@ -39,15 +39,18 @@
fill: $gl-text-color-secondary; fill: $gl-text-color-secondary;
} }
&.open-icon svg { &.opened-icon,
&.created-icon {
svg {
fill: $green-300; fill: $green-300;
} }
}
&.closed-icon svg { &.closed-icon svg {
fill: $red-300; fill: $red-300;
} }
&.fork-icon svg { &.accepted-icon svg {
fill: $blue-300; fill: $blue-300;
} }
} }
......
module SystemNoteHelper module SystemNoteHelper
ICON_NAMES_BY_ACTION = { ICON_NAMES_BY_ACTION = {
'commit' => 'icon_commit', 'commit' => 'icon_commit',
'push' => 'icon_commit',
'merge' => 'icon_merge', 'merge' => 'icon_merge',
'merged' => 'icon_merged', 'merged' => 'icon_merged',
'opened' => 'icon_status_open', 'opened' => 'icon_status_open',
'created' => 'icon_status_open',
'closed' => 'icon_status_closed', 'closed' => 'icon_status_closed',
'time_tracking' => 'icon_stopwatch', 'time_tracking' => 'icon_stopwatch',
'assignee' => 'icon_user', 'assignee' => 'icon_user',
...@@ -12,15 +14,18 @@ module SystemNoteHelper ...@@ -12,15 +14,18 @@ module SystemNoteHelper
'label' => 'icon_tags', 'label' => 'icon_tags',
'cross_reference' => 'icon_random', 'cross_reference' => 'icon_random',
'branch' => 'icon_code_fork', 'branch' => 'icon_code_fork',
'accepted' => 'icon_code_fork',
'confidential' => 'icon_eye_slash', 'confidential' => 'icon_eye_slash',
'visible' => 'icon_eye', 'visible' => 'icon_eye',
'milestone' => 'icon_clock_o', 'milestone' => 'icon_clock_o',
'discussion' => 'icon_comment_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 }.freeze
def icon_for_system_note(note) 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 custom_icon(icon_name) if icon_name
end end
end end
- if current_path?('users#show') - if current_path?('users#show')
- if event.target - if event.target
- case event.action_name .system-note-image{ class: "#{event.action_name}-icon" }
- when 'opened' = icon_for_system_note(event.action_name)
.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")
- else - else
.system-note-image.user-avatar .system-note-image.user-avatar
= author_avatar(event, size: 32) = author_avatar(event, size: 32)
.event-title .event-title
%span.author_name= link_to_author event %span.author_name= link_to_author event
%span{ class: event.action_name } %span{ class: event.action_name }
......
- if current_path?('users#show') - if current_path?('users#show')
.system-note-image.open-icon .system-note-image{ class: "#{event.action_name}-icon" }
= custom_icon("icon_status_open") = icon_for_system_note(event.action_name)
- else - else
.system-note-image.user-avatar .system-note-image.user-avatar
= author_avatar(event, size: 32) = author_avatar(event, size: 32)
......
- if current_path?('users#show') - if current_path?('users#show')
.system-note-image .system-note-image
= custom_icon("icon_comment_o") = icon_for_system_note(event.action_name)
- else - else
.system-note-image.user-avatar .system-note-image.user-avatar
= author_avatar(event, size: 32) = author_avatar(event, size: 32)
......
- project = event.project - project = event.project
- if current_path?('users#show') - if current_path?('users#show')
.system-note-image .system-note-image
- if event.action_name == "deleted" = icon_for_system_note(event.data[:event_name])
= custom_icon("trash_o")
- else
= custom_icon("icon_commit")
- else - else
.system-note-image.user-avatar .system-note-image.user-avatar
= author_avatar(event, size: 32) = author_avatar(event, size: 32)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.timeline-entry-inner .timeline-entry-inner
.timeline-icon .timeline-icon
- if note.system - if note.system
= icon_for_system_note(note) = icon_for_system_note(note.system_note_metadata&.action)
- else - else
%a{ href: user_path(note.author) } %a{ href: user_path(note.author) }
= image_tag avatar_icon(note.author), alt: '', class: 'avatar s40' = 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