diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-12 21:41:15 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-04-12 21:41:15 +0000 |
commit | 3e19ecae1774f4bbe234c54b0b41c25c78021813 (patch) | |
tree | b1341a1c7fefade0a70eef8986aacd165b192cef | |
parent | d5143af98e5e0f919ea08d8341a5d5b00e4a3095 (diff) | |
parent | 8552d120d1665ff32948de9657b86a923c7bd4d6 (diff) | |
download | gitlab-ce-3e19ecae1774f4bbe234c54b0b41c25c78021813.tar.gz |
Merge branch 'use-avatars-in-activity-view' into 'master'
Use avatars instead of icons in activity view
See merge request !10596
-rw-r--r-- | app/assets/stylesheets/pages/events.scss | 22 | ||||
-rw-r--r-- | app/helpers/events_helper.rb | 28 | ||||
-rw-r--r-- | app/views/events/event/_common.html.haml | 11 | ||||
-rw-r--r-- | app/views/events/event/_created_project.html.haml | 3 | ||||
-rw-r--r-- | app/views/events/event/_note.html.haml | 3 | ||||
-rw-r--r-- | app/views/events/event/_push.html.haml | 6 | ||||
-rw-r--r-- | app/views/shared/icons/_icon_trash_o.svg (renamed from app/views/shared/icons/_trash_o.svg) | 0 |
7 files changed, 46 insertions, 27 deletions
diff --git a/app/assets/stylesheets/pages/events.scss b/app/assets/stylesheets/pages/events.scss index 79da490675a..5b723f7c722 100644 --- a/app/assets/stylesheets/pages/events.scss +++ b/app/assets/stylesheets/pages/events.scss @@ -10,10 +10,14 @@ position: relative; &.event-inline { - .profile-icon { + .system-note-image { top: 20px; } + .user-avatar { + top: 14px; + } + .event-title, .event-item-timestamp { line-height: 40px; @@ -24,7 +28,7 @@ color: $gl-text-color; } - .profile-icon { + .system-note-image { position: absolute; left: 0; top: 14px; @@ -35,15 +39,18 @@ fill: $gl-text-color-secondary; } - &.open-icon svg { - fill: $green-300; + &.opened-icon, + &.created-icon { + svg { + fill: $green-300; + } } &.closed-icon svg { fill: $red-300; } - &.fork-icon svg { + &.accepted-icon svg { fill: $blue-300; } } @@ -128,8 +135,7 @@ li { &.commit { background: transparent; - padding: 3px; - padding-left: 0; + padding: 0; border: none; .commit-row-title { @@ -183,7 +189,7 @@ max-width: 100%; } - .profile-icon { + .system-note-image { display: none; } diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index fb872a13f74..5f5c76d3722 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -1,4 +1,15 @@ module EventsHelper + ICON_NAMES_BY_EVENT_TYPE = { + 'pushed to' => 'icon_commit', + 'pushed new' => 'icon_commit', + 'created' => 'icon_status_open', + 'opened' => 'icon_status_open', + 'closed' => 'icon_status_closed', + 'accepted' => 'icon_code_fork', + 'commented on' => 'icon_comment_o', + 'deleted' => 'icon_trash_o' + }.freeze + def link_to_author(event) author = event.author @@ -183,4 +194,21 @@ module EventsHelper "event-inline" end end + + def icon_for_event(note) + icon_name = ICON_NAMES_BY_EVENT_TYPE[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.parameterize}-icon" do + icon_for_event(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 af97e9588a5..01e72862114 100644 --- a/app/views/events/event/_common.html.haml +++ b/app/views/events/event/_common.html.haml @@ -1,13 +1,4 @@ -- if event.target - - if event.action_name == "opened" - .profile-icon.open-icon - = custom_icon("icon_status_open") - - elsif event.action_name == "closed" - .profile-icon.closed-icon - = custom_icon("icon_status_closed") - - else - .profile-icon.fork-icon - = custom_icon("icon_code_fork") += 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 fee85c94277..d8e59be57bb 100644 --- a/app/views/events/event/_created_project.html.haml +++ b/app/views/events/event/_created_project.html.haml @@ -1,5 +1,4 @@ -.profile-icon.open-icon - = custom_icon("icon_status_open") += 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 83709f5e4d0..df4b9562215 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -1,5 +1,4 @@ -.profile-icon - = custom_icon("icon_comment_o") += 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 efdc8764acf..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 -.profile-icon - - if event.action_name == "deleted" - = custom_icon("trash_o") - - else - = custom_icon("icon_commit") += 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 |