From 466ca12ee4b3b76f66c4454e7387cfd841d88262 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Tue, 11 Apr 2017 13:24:04 -0500 Subject: Add helper for using avatars vs icons --- app/helpers/system_note_helper.rb | 15 ++++++++++++++- app/views/events/event/_common.html.haml | 8 +------- app/views/events/event/_created_project.html.haml | 8 +------- app/views/events/event/_note.html.haml | 7 +------ app/views/events/event/_push.html.haml | 8 ++------ app/views/shared/icons/_icon_trash_o.svg | 1 + app/views/shared/icons/_trash_o.svg | 1 - 7 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 app/views/shared/icons/_icon_trash_o.svg delete mode 100644 app/views/shared/icons/_trash_o.svg (limited to 'app') diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb index 91673ea5036..efe661a646a 100644 --- a/app/helpers/system_note_helper.rb +++ b/app/helpers/system_note_helper.rb @@ -1,7 +1,8 @@ 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 diff --git a/app/views/events/event/_common.html.haml b/app/views/events/event/_common.html.haml index b7cb5d3ed63..01e72862114 100644 --- a/app/views/events/event/_common.html.haml +++ b/app/views/events/event/_common.html.haml @@ -1,10 +1,4 @@ -- 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 diff --git a/app/views/events/event/_created_project.html.haml b/app/views/events/event/_created_project.html.haml index c08c9442fa9..d8e59be57bb 100644 --- a/app/views/events/event/_created_project.html.haml +++ b/app/views/events/event/_created_project.html.haml @@ -1,10 +1,4 @@ -- 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 diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index d5dcc9339ac..df4b9562215 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -1,9 +1,4 @@ -- 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 diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml index be0eb6cb5ee..c0943100ae3 100644 --- a/app/views/events/event/_push.html.haml +++ b/app/views/events/event/_push.html.haml @@ -1,10 +1,6 @@ - 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 diff --git a/app/views/shared/icons/_icon_trash_o.svg b/app/views/shared/icons/_icon_trash_o.svg new file mode 100644 index 00000000000..0d7a91ab536 --- /dev/null +++ b/app/views/shared/icons/_icon_trash_o.svg @@ -0,0 +1 @@ + diff --git a/app/views/shared/icons/_trash_o.svg b/app/views/shared/icons/_trash_o.svg deleted file mode 100644 index 0d7a91ab536..00000000000 --- a/app/views/shared/icons/_trash_o.svg +++ /dev/null @@ -1 +0,0 @@ - -- cgit v1.2.3