summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-04-11 13:24:04 -0500
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-04-11 13:47:41 -0500
commit466ca12ee4b3b76f66c4454e7387cfd841d88262 (patch)
tree81ab088797cd9ba2e356875615bdd0bd39b1111a
parent71b7461f371c2257d85ab05c8463e440f569053d (diff)
downloadgitlab-ce-466ca12ee4b3b76f66c4454e7387cfd841d88262.tar.gz
Add helper for using avatars vs icons
-rw-r--r--app/helpers/system_note_helper.rb15
-rw-r--r--app/views/events/event/_common.html.haml8
-rw-r--r--app/views/events/event/_created_project.html.haml8
-rw-r--r--app/views/events/event/_note.html.haml7
-rw-r--r--app/views/events/event/_push.html.haml8
-rw-r--r--app/views/shared/icons/_icon_trash_o.svg (renamed from app/views/shared/icons/_trash_o.svg)0
6 files changed, 19 insertions, 27 deletions
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/_trash_o.svg b/app/views/shared/icons/_icon_trash_o.svg
index 0d7a91ab536..0d7a91ab536 100644
--- a/app/views/shared/icons/_trash_o.svg
+++ b/app/views/shared/icons/_icon_trash_o.svg