Commit 466ca12e authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Add helper for using avatars vs icons

parent 71b7461f
module SystemNoteHelper
ICON_NAMES_BY_ACTION = {
'commit' => 'icon_commit',
'push' => 'icon_commit',
'pushed to' => 'icon_commit',
'pushed new' => 'icon_commit',
'merge' => 'icon_merge',
'merged' => 'icon_merged',
'opened' => 'icon_status_open',
......@@ -28,4 +29,16 @@ module SystemNoteHelper
icon_name = ICON_NAMES_BY_ACTION[note]
custom_icon(icon_name) if icon_name
end
def icon_for_profile_event(event)
if current_path?('users#show')
content_tag :div, class: "system-note-image #{event.action_name}-icon" do
icon_for_system_note(event.action_name)
end
else
content_tag :div, class: 'system-note-image user-avatar' do
author_avatar(event, size: 32)
end
end
end
end
- if current_path?('users#show')
- if event.target
.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)
= icon_for_profile_event(event)
.event-title
%span.author_name= link_to_author event
......
- if current_path?('users#show')
.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)
= icon_for_profile_event(event)
.event-title
%span.author_name= link_to_author event
......
- if current_path?('users#show')
.system-note-image
= icon_for_system_note(event.action_name)
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
= icon_for_profile_event(event)
.event-title
%span.author_name= link_to_author event
......
- project = event.project
- if current_path?('users#show')
.system-note-image
= icon_for_system_note(event.data[:event_name])
- else
.system-note-image.user-avatar
= author_avatar(event, size: 32)
= icon_for_profile_event(event)
.event-title
%span.author_name= link_to_author event
......
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