From 25e629e460c30bb903be52dbf28fcc499566f318 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 Aug 2013 21:31:37 +0300 Subject: [PATCH] Render small avatars for inline events --- app/assets/stylesheets/sections/events.scss | 7 +++++++ app/models/event.rb | 10 ++++++++++ app/views/events/_event.html.haml | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 9b049aed5fb..d94d97c8d9a 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -35,6 +35,13 @@ padding-top: 0; } + &.event-inline { + .avatar { + width: 16px; + height: 16px; + } + } + padding: 14px 0px; border-bottom: 1px solid #eee; .event-title { diff --git a/app/models/event.rb b/app/models/event.rb index 759e84bb55a..5c7c5be4190 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -291,4 +291,14 @@ class Event < ActiveRecord::Base "Wall" end.downcase end + + def body? + if push? + push_with_commits? + elsif note? + true + else + target.respond_to? :title + end + end end diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index b090148685f..b3543460d65 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -1,5 +1,5 @@ - if event.proper? - %div.event-item + .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} %span.cgray.pull-right #{time_ago_in_words(event.created_at)} ago.