BigW Consortium Gitlab

Commit 466ca12e by Annabel Dunstone Gray

Add helper for using avatars vs icons

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