contacts now ajax in on aspect filtering on aspect/index. fixed missing partial error on aspect_badge.

This commit is contained in:
danielvincent 2011-01-06 16:20:55 -08:00
parent 422f17a648
commit f44b3cbe3d
6 changed files with 19 additions and 14 deletions

View file

@ -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' @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 @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 @contact_hashes = hashes_for_contacts @contacts
@aspect_hashes = hashes_for_aspects @all_aspects, @contacts, :limit => 8
@aspect = :all unless params[:a_ids] @aspect = :all unless params[:a_ids]

View file

@ -34,13 +34,17 @@ module ApplicationHelper
def aspect_badges aspects def aspect_badges aspects
str = '' str = ''
aspects.each do |aspect| aspects.each do |aspect|
str << "<span class='aspect_badge single'>" str << aspect_badge(aspect)
str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe
str << "</span>"
end end
str.html_safe str.html_safe
end end
def aspect_badge aspect
str = "<span class='aspect_badge single'>"
str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe
str << "</span>"
end
def aspect_links aspects, opts={} def aspect_links aspects, opts={}
str = "" str = ""
aspects.each do |a| aspects.each do |a|

View file

@ -49,9 +49,9 @@ module AspectsHelper
else else
str = "#{t('.post_a_message_to', :aspect => aspect_count)} " str = "#{t('.post_a_message_to', :aspect => aspect_count)} "
if aspect_count == 1 if aspect_count == 1
str += t('_aspect') str += t('_aspect').downcase
else else
str += t('_aspects') str += t('_aspects').downcase
end end
end end
(link_to str, '#', :id => 'expand_publisher').html_safe (link_to str, '#', :id => 'expand_publisher').html_safe

View file

@ -17,7 +17,7 @@
:post_hashes => @post_hashes :post_hashes => @post_hashes
.span-7.last .span-7.last
= owner_image_tag = owner_image_link
%h3{:style => "position:relative;display:inline-block;margin-left:12px;top:-8px;"} %h3{:style => "position:relative;display:inline-block;margin-left:12px;top:-8px;"}
= current_user.name = current_user.name
.description .description
@ -42,12 +42,8 @@
= render :partial => 'aspects/aspect', :locals => a_hash = render :partial => 'aspects/aspect', :locals => a_hash
.section.contact_pictures .section.contact_pictures
%h4 #aspect_contact_pictures
= t('_contacts') = render 'aspects/aspect_contact_pictures', :contact_hashes => @contact_hashes
= link_to @contact_hashes.count, '#'
- for contact in @contact_hashes
= person_image_link(contact[:person])
- if @contacts.count == 0 - if @contacts.count == 0
%h4 %h4

View file

@ -1 +1,2 @@
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :post_hashes => @post_hashes)) %>"); $('#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)) %>");

View file

@ -35,6 +35,7 @@ $(document).ready(function(){
// loading animation // loading animation
$("#aspect_stream_container").fadeTo(100, 0.4); $("#aspect_stream_container").fadeTo(100, 0.4);
$("#aspect_contact_pictures").fadeTo(100, 0.4);
performAjax( $(this).attr('href'), $("#publisher textarea").val()); performAjax( $(this).attr('href'), $("#publisher textarea").val());
}); });
@ -46,6 +47,7 @@ $(document).ready(function(){
// loading animation // loading animation
$("#aspect_stream_container").fadeTo(100, 0.4); $("#aspect_stream_container").fadeTo(100, 0.4);
$("#aspect_contact_pictures").fadeTo(100, 0.4);
// filtering ////////////////////// // filtering //////////////////////
var $this = $(this), var $this = $(this),
@ -119,6 +121,7 @@ $(document).ready(function(){
// fade contents back in // fade contents back in
if(requests == 0){ if(requests == 0){
$("#aspect_stream_container").fadeTo(100, 1); $("#aspect_stream_container").fadeTo(100, 1);
$("#aspect_contact_pictures").fadeTo(100, 1);
} }
} }
}); });