diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index b3a882e7e..12e3d4326 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -21,9 +21,10 @@ class AspectsController < ApplicationController @posts = Post.where(:id.in => post_ids, :_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' @post_hashes = hashes_for_posts @posts - @contacts = Contact.all(:user_id => current_user.id, :pending => false) - @aspect_hashes = hashes_for_aspects @all_aspects, @contacts, :limit => 8 + + @contacts = Contact.all(:aspect_ids.in => @aspect_ids, :user_id => current_user.id, :pending => false) @contact_hashes = hashes_for_contacts @contacts + @aspect_hashes = hashes_for_aspects @all_aspects, @contacts, :limit => 8 @aspect = :all unless params[:a_ids] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 66dfbe5fc..d19474fca 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -34,13 +34,17 @@ module ApplicationHelper def aspect_badges aspects str = '' aspects.each do |aspect| - str << "" - str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe - str << "" + str << aspect_badge(aspect) end str.html_safe end + def aspect_badge aspect + str = "" + str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe + str << "" + end + def aspect_links aspects, opts={} str = "" aspects.each do |a| diff --git a/app/helpers/aspects_helper.rb b/app/helpers/aspects_helper.rb index f13fa4488..747041a69 100644 --- a/app/helpers/aspects_helper.rb +++ b/app/helpers/aspects_helper.rb @@ -49,9 +49,9 @@ module AspectsHelper else str = "#{t('.post_a_message_to', :aspect => aspect_count)} " if aspect_count == 1 - str += t('_aspect') + str += t('_aspect').downcase else - str += t('_aspects') + str += t('_aspects').downcase end end (link_to str, '#', :id => 'expand_publisher').html_safe diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 8aa35d555..1c5494b53 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -17,7 +17,7 @@ :post_hashes => @post_hashes .span-7.last - = owner_image_tag + = owner_image_link %h3{:style => "position:relative;display:inline-block;margin-left:12px;top:-8px;"} = current_user.name .description @@ -42,12 +42,8 @@ = render :partial => 'aspects/aspect', :locals => a_hash .section.contact_pictures - %h4 - = t('_contacts') - = link_to @contact_hashes.count, '#' - - - for contact in @contact_hashes - = person_image_link(contact[:person]) + #aspect_contact_pictures + = render 'aspects/aspect_contact_pictures', :contact_hashes => @contact_hashes - if @contacts.count == 0 %h4 diff --git a/app/views/aspects/index.js.erb b/app/views/aspects/index.js.erb index 2b6d2686d..16980c787 100644 --- a/app/views/aspects/index.js.erb +++ b/app/views/aspects/index.js.erb @@ -1 +1,2 @@ $('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :post_hashes => @post_hashes)) %>"); +$('#aspect_contact_pictures').html("<%= escape_javascript(render('aspects/aspect_contact_pictures', :contact_hashes => @contact_hashes)) %>"); diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js index 9973ea039..f81861b99 100644 --- a/public/javascripts/aspect-filters.js +++ b/public/javascripts/aspect-filters.js @@ -35,6 +35,7 @@ $(document).ready(function(){ // loading animation $("#aspect_stream_container").fadeTo(100, 0.4); + $("#aspect_contact_pictures").fadeTo(100, 0.4); performAjax( $(this).attr('href'), $("#publisher textarea").val()); }); @@ -46,6 +47,7 @@ $(document).ready(function(){ // loading animation $("#aspect_stream_container").fadeTo(100, 0.4); + $("#aspect_contact_pictures").fadeTo(100, 0.4); // filtering ////////////////////// var $this = $(this), @@ -119,6 +121,7 @@ $(document).ready(function(){ // fade contents back in if(requests == 0){ $("#aspect_stream_container").fadeTo(100, 1); + $("#aspect_contact_pictures").fadeTo(100, 1); } } });