fixed inf scroll on filters issue. one spec failing in AspectsController.
This commit is contained in:
parent
d0b25814b1
commit
44d3c4bacd
7 changed files with 34 additions and 11 deletions
|
|
@ -90,7 +90,7 @@ class AspectsController < ApplicationController
|
|||
@aspect = :manage
|
||||
@contacts = current_user.contacts.where(:pending => false)
|
||||
@remote_requests = Request.hashes_for_person(current_user.person)
|
||||
@aspect_hashes = hashes_for_aspects @aspects, @contacts
|
||||
@aspect_hashes = hashes_for_aspects @all_aspects, @contacts
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
- content_for :head do
|
||||
= include_javascripts :home
|
||||
|
||||
- content_for :page_title do
|
||||
= @aspect.name.html_safe
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ $(document).ready(function(){
|
|||
// (not cached because this element changes)
|
||||
$("#publisher textarea").val(post);
|
||||
|
||||
$('html, body').animate({scrollTop:0}, 'fast');
|
||||
|
||||
// reinit listeners on stream
|
||||
Stream.initialize();
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ var Stream = {
|
|||
$(this).parents(".status_message").fadeOut(150);
|
||||
});
|
||||
|
||||
// inf scroll
|
||||
Stream.infiniteScroll($stream);
|
||||
},
|
||||
|
||||
toggleComments: function(evt) {
|
||||
|
|
@ -178,6 +180,21 @@ var Stream = {
|
|||
commentBlock.find('textarea').focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
infiniteScroll: function(stream){
|
||||
stream.infinitescroll({
|
||||
navSelector : "div.pagination",
|
||||
// selector for the paged navigation (it will be hidden)
|
||||
nextSelector : ".pagination a.next_page",
|
||||
// selector for the NEXT link (to page 2)
|
||||
itemSelector : "#main_stream .stream_element",
|
||||
// selector for all items you'll retrieve
|
||||
bufferPx: 300,
|
||||
donetext: "no more.",
|
||||
loadingText: "",
|
||||
loadingImg: '/images/ajax-loader.gif'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ header
|
|||
:bottom 1px solid #777
|
||||
|
||||
:padding 0
|
||||
:top 5px
|
||||
:top 2px
|
||||
:color #CCC
|
||||
|
||||
:position fixed
|
||||
|
|
@ -921,7 +921,7 @@ label
|
|||
|
||||
#aspect_nav
|
||||
:margin
|
||||
:top 7px
|
||||
:top 3px
|
||||
:bottom 2px
|
||||
:bottom 0
|
||||
:color #000
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe AspectsController do
|
|||
@user = make_user
|
||||
@user2 = make_user
|
||||
|
||||
@aspect0 = @user.aspects.create(:name => "lame-os")
|
||||
@aspect0 = @user.aspects.create(:name => "lame-os")
|
||||
@aspect1 = @user.aspects.create(:name => "another aspect")
|
||||
@aspect2 = @user2.aspects.create(:name => "party people")
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ describe AspectsController do
|
|||
end
|
||||
|
||||
context 'filtering' do
|
||||
before(:all) do
|
||||
before do
|
||||
@posts = []
|
||||
@users = []
|
||||
8.times do |n|
|
||||
|
|
@ -97,7 +97,7 @@ describe AspectsController do
|
|||
end
|
||||
it "assigns aspect, aspect_contacts, and posts" do
|
||||
get :show, 'id' => @aspect0.id.to_s
|
||||
assigns(:aspect).should == @aspect
|
||||
assigns(:aspect).should == @aspect0
|
||||
achash = @controller.send(:hashes_for_contacts, @aspect0.contacts).first
|
||||
assigns(:aspect_contacts).first[:contact].should == achash[:contact]
|
||||
assigns(:aspect_contacts).first[:person].should == achash[:person]
|
||||
|
|
@ -105,7 +105,7 @@ describe AspectsController do
|
|||
end
|
||||
it "assigns contacts to only non-pending" do
|
||||
@user.contacts.count.should == 1
|
||||
@user.send_contact_request_to(make_user.person, @aspect)
|
||||
@user.send_contact_request_to(make_user.person, @aspect0)
|
||||
@user.contacts.count.should == 2
|
||||
|
||||
get :show, 'id' => @aspect0.id.to_s
|
||||
|
|
@ -164,7 +164,7 @@ describe AspectsController do
|
|||
end
|
||||
it "assigns contacts to only non-pending" do
|
||||
@user.contacts.count.should == 1
|
||||
@user.send_contact_request_to(make_user.person, @aspect)
|
||||
@user.send_contact_request_to(make_user.person, @aspect0)
|
||||
@user.contacts.count.should == 2
|
||||
|
||||
get :manage
|
||||
|
|
@ -251,7 +251,7 @@ describe AspectsController do
|
|||
end
|
||||
it 'has aspects' do
|
||||
@hashes.length.should == 2
|
||||
@hash[:aspect].should == @aspect
|
||||
@hash[:aspect].should == @aspect0
|
||||
end
|
||||
it 'has a contact_count' do
|
||||
@hash[:contact_count].should == @aspect0.contacts.count
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ describe StatusMessagesController do
|
|||
{ :status_message => {
|
||||
:public =>"true",
|
||||
:message =>"facebook, is that you?",
|
||||
:aspect_ids =>"#{aspect1.id}" }
|
||||
}
|
||||
},
|
||||
:aspect_ids =>"#{aspect1.id}" }
|
||||
}
|
||||
it 'responds to js requests' do
|
||||
post :create, status_message_hash.merge(:format => 'js')
|
||||
|
|
|
|||
Loading…
Reference in a new issue