From b8790707443e10790ef3c2c539571df787772d8a Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 26 Oct 2011 23:50:01 -0700 Subject: [PATCH] avatars for likes --- app/controllers/likes_controller.rb | 1 + app/views/likes/_likes.haml | 3 ++- public/javascripts/view.js | 12 ++++++++++-- public/javascripts/widgets/likes.js | 6 ++++-- public/stylesheets/sass/application.sass | 9 ++++++--- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index d8a49fad4..deedb753a 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -51,6 +51,7 @@ class LikesController < ApplicationController def index if target @likes = target.likes.includes(:author => :profile) + @people = @likes.map{|x| x.author} render :layout => false else render :nothing => true, :status => 404 diff --git a/app/views/likes/_likes.haml b/app/views/likes/_likes.haml index a3cc3aee7..a2e89298d 100644 --- a/app/views/likes/_likes.haml +++ b/app/views/likes/_likes.haml @@ -2,5 +2,6 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -= notification_people_link(nil, likes.map{|x| x.author}) +- @people[0..17].each do |person| + = person_image_link(person) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index e2e09f0e5..2201a712b 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -129,11 +129,19 @@ var View = { }); } }, + contacts_on_side: { bind: function() { $("#selected_aspect_contacts .avatar").twipsy({ - live: true, - placement: 'right' + live: true + }); + } + }, + + like_avatars: { + bind: function() { + $(".likes_list .avatar").twipsy({ + live: true }); } }, diff --git a/public/javascripts/widgets/likes.js b/public/javascripts/widgets/likes.js index b7c7ad89d..fb233e9fc 100644 --- a/public/javascripts/widgets/likes.js +++ b/public/javascripts/widgets/likes.js @@ -21,8 +21,10 @@ $.get(self.expander.attr('href'), function(data) { self.loadingImage.fadeOut(100, function() { - self.likesList.html(data) - .fadeToggle(100); + self.expander.fadeOut(100, function(){ + self.likesList.html(data) + .fadeToggle(100); + }); }); }); } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 06b7ca75e..ff00e4915 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -749,7 +749,6 @@ form.new_comment :margin :left 5px - .stream.show ul.comments li @@ -2258,8 +2257,6 @@ ul.show_comments, :color #999 .likes_container - :margin - :bottom -4px :padding 4px ul.show_comments, @@ -3429,3 +3426,9 @@ a.toggle_selector &:hover @include opacity(1) + +.likes_list + .avatar + :float none + :height 20px + :width 20px