OSDN Git Service

Render small avatars for inline events
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 20 Aug 2013 18:31:37 +0000 (21:31 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 20 Aug 2013 18:31:37 +0000 (21:31 +0300)
app/assets/stylesheets/sections/events.scss
app/models/event.rb
app/views/events/_event.html.haml

index 9b049ae..d94d97c 100644 (file)
     padding-top: 0;
   }
 
+  &.event-inline {
+    .avatar {
+      width: 16px;
+      height: 16px;
+    }
+  }
+
   padding: 14px 0px;
   border-bottom: 1px solid #eee;
   .event-title {
index 759e84b..5c7c5be 100644 (file)
@@ -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
index b090148..b354346 100644 (file)
@@ -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.