Don't retrieve all the user's contacts again unnecessarily
This commit is contained in:
parent
8ee81314d6
commit
770091e82b
5 changed files with 5 additions and 9 deletions
|
|
@ -36,7 +36,7 @@ class AspectsController < ApplicationController
|
||||||
:page => params[:page], :per_page => 15, :order => sort_order + ' DESC')
|
:page => params[:page], :per_page => 15, :order => sort_order + ' DESC')
|
||||||
@fakes = PostsFake.new(@posts)
|
@fakes = PostsFake.new(@posts)
|
||||||
|
|
||||||
@contacts = current_user.contacts.includes(:person => :profile)
|
@contact_count = current_user.contacts.count
|
||||||
|
|
||||||
@aspect = :all unless params[:a_ids]
|
@aspect = :all unless params[:a_ids]
|
||||||
@aspect ||= @aspects.first #used in mobile
|
@aspect ||= @aspects.first #used in mobile
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
%h4
|
%h4
|
||||||
.right
|
.right
|
||||||
= link_to t('contacts', :count => contacts.count), aspects_manage_path, :title => t('aspects.manage.manage_aspects')
|
= link_to t('contacts', :count => @contact_count), aspects_manage_path, :title => t('aspects.manage.manage_aspects')
|
||||||
|
|
||||||
= aspects.count
|
= aspects.count
|
||||||
- if aspects.count == 1
|
- if aspects.count == 1
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
.span-15.append-2
|
.span-15.append-2
|
||||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contact_count
|
||||||
|
|
||||||
#aspect_stream_container
|
#aspect_stream_container
|
||||||
= render 'aspect_stream',
|
= render 'aspect_stream',
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
#aspect_listings.section
|
#aspect_listings.section
|
||||||
= render 'aspects/aspect_listings', :aspects => @aspects, :contacts => @contacts
|
= render 'aspects/aspect_listings', :aspects => @aspects
|
||||||
|
|
||||||
- if @invites <= 0
|
- if @invites <= 0
|
||||||
.section.invite_friends
|
.section.invite_friends
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :posts => @posts, :fakes => @fakes)) %>");
|
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :posts => @posts, :fakes => @fakes)) %>");
|
||||||
$('#aspect_listings').html("<%= escape_javascript(render('aspects/aspect_listings', :aspects => @aspects, :contacts => @contacts)) %>");
|
$('#aspect_listings').html("<%= escape_javascript(render('aspects/aspect_listings', :aspects => @aspects)) %>");
|
||||||
$('a[rel*=facebox]').facebox();
|
$('a[rel*=facebox]').facebox();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,6 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#index" do
|
describe "#index" do
|
||||||
it "assigns @contacts to all the user's contacts" do
|
|
||||||
get :index
|
|
||||||
assigns[:contacts].map{|c| c.id}.should == @user.contacts.map{|c| c.id}
|
|
||||||
end
|
|
||||||
it "generates a jasmine fixture" do
|
it "generates a jasmine fixture" do
|
||||||
get :index
|
get :index
|
||||||
save_fixture(html_for("body"), "aspects_index")
|
save_fixture(html_for("body"), "aspects_index")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue