Stop loading contact objects on the main page, all we need is people
This commit is contained in:
parent
24d84d7756
commit
f161377480
6 changed files with 11 additions and 12 deletions
|
|
@ -27,10 +27,10 @@ class AspectsController < ApplicationController
|
|||
end
|
||||
|
||||
unless params[:only_posts]
|
||||
all_selected_contacts = Contact.joins(:aspect_memberships).
|
||||
where(:aspect_memberships => {:aspect_id => aspect_ids})
|
||||
@selected_contacts_count = all_selected_contacts.count
|
||||
@selected_contacts = all_selected_contacts.includes(:person => :profile)
|
||||
all_selected_people = Person.joins(:contacts => :aspect_memberships).
|
||||
where(:contacts => {:user_id => current_user.id},
|
||||
:aspect_memberships => {:aspect_id => aspect_ids})
|
||||
@selected_people = all_selected_people.select("DISTINCT people.*").includes(:profile)
|
||||
end
|
||||
|
||||
@aspect_ids = @aspects.map { |a| a.id }
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
= "(#{count})"
|
||||
|
||||
.content
|
||||
- if contacts.size > 0
|
||||
- for contact in contacts
|
||||
= person_image_link contact.person
|
||||
- if people.size > 0
|
||||
- for person in people
|
||||
= person_image_link person
|
||||
|
||||
- if @aspect_ids.size > 1
|
||||
= link_to t('.view_all_contacts'), contacts_path, :id => "view_all_contacts_link"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
:posts => @posts
|
||||
|
||||
.span-5.rightBar.last
|
||||
= render 'selected_contacts', :contacts => @selected_contacts[0..19], :count => @selected_contacts_count
|
||||
= render 'selected_contacts', :people => @selected_people[0..19], :count => @selected_people.size
|
||||
|
||||
.section
|
||||
.title
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :posts => @posts)) %>");
|
||||
$('#selected_aspect_contacts').html("<%= escape_javascript(render('aspects/selected_contacts', :count => @selected_contacts_count, :contacts => @selected_contacts[0..19])) %>");
|
||||
$('#selected_aspect_contacts').html("<%= escape_javascript(render('aspects/selected_contacts', :people => @selected_people[0..19], :count => @selected_people.size )) %>");
|
||||
$('#aspect_stream_container a[rel*=facebox]').facebox();
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
#publisher.closed{:class => ((aspect == :profile)? 'mention_popup' : nil )}
|
||||
.content_creation
|
||||
= form_for(StatusMessage.new, :remote => true, :html => {"data-type" => "json"}) do |status|
|
||||
- if @selected_contacts
|
||||
= hidden_field_tag :contact_json, @selected_contacts.map{|contact| contact.person}.to_json
|
||||
- if @selected_people
|
||||
= hidden_field_tag :contact_json, @selected_people.to_json
|
||||
= status.error_messages
|
||||
%p
|
||||
%params
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#For Guidance
|
||||
#http://github.com/thoughtbot/factory_girl
|
||||
# http://railscasts.com/episodes/158-factories-not-fixtures
|
||||
#This inclsion, because gpg-agent(not needed) is never run and hence never sets any env. variables on a MAC
|
||||
|
||||
def r_str
|
||||
ActiveSupport::SecureRandom.hex(3)
|
||||
|
|
|
|||
Loading…
Reference in a new issue