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
|
@aspect = :manage
|
||||||
@contacts = current_user.contacts.where(:pending => false)
|
@contacts = current_user.contacts.where(:pending => false)
|
||||||
@remote_requests = Request.hashes_for_person(current_user.person)
|
@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
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
|
- content_for :head do
|
||||||
|
= include_javascripts :home
|
||||||
|
|
||||||
- content_for :page_title do
|
- content_for :page_title do
|
||||||
= @aspect.name.html_safe
|
= @aspect.name.html_safe
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ $(document).ready(function(){
|
||||||
// (not cached because this element changes)
|
// (not cached because this element changes)
|
||||||
$("#publisher textarea").val(post);
|
$("#publisher textarea").val(post);
|
||||||
|
|
||||||
|
$('html, body').animate({scrollTop:0}, 'fast');
|
||||||
|
|
||||||
// reinit listeners on stream
|
// reinit listeners on stream
|
||||||
Stream.initialize();
|
Stream.initialize();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,8 @@ var Stream = {
|
||||||
$(this).parents(".status_message").fadeOut(150);
|
$(this).parents(".status_message").fadeOut(150);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// inf scroll
|
||||||
|
Stream.infiniteScroll($stream);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleComments: function(evt) {
|
toggleComments: function(evt) {
|
||||||
|
|
@ -178,6 +180,21 @@ var Stream = {
|
||||||
commentBlock.find('textarea').focus();
|
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
|
:bottom 1px solid #777
|
||||||
|
|
||||||
:padding 0
|
:padding 0
|
||||||
:top 5px
|
:top 2px
|
||||||
:color #CCC
|
:color #CCC
|
||||||
|
|
||||||
:position fixed
|
:position fixed
|
||||||
|
|
@ -921,7 +921,7 @@ label
|
||||||
|
|
||||||
#aspect_nav
|
#aspect_nav
|
||||||
:margin
|
:margin
|
||||||
:top 7px
|
:top 3px
|
||||||
:bottom 2px
|
:bottom 2px
|
||||||
:bottom 0
|
:bottom 0
|
||||||
:color #000
|
:color #000
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe AspectsController do
|
||||||
@user = make_user
|
@user = make_user
|
||||||
@user2 = 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")
|
@aspect1 = @user.aspects.create(:name => "another aspect")
|
||||||
@aspect2 = @user2.aspects.create(:name => "party people")
|
@aspect2 = @user2.aspects.create(:name => "party people")
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'filtering' do
|
context 'filtering' do
|
||||||
before(:all) do
|
before do
|
||||||
@posts = []
|
@posts = []
|
||||||
@users = []
|
@users = []
|
||||||
8.times do |n|
|
8.times do |n|
|
||||||
|
|
@ -97,7 +97,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
it "assigns aspect, aspect_contacts, and posts" do
|
it "assigns aspect, aspect_contacts, and posts" do
|
||||||
get :show, 'id' => @aspect0.id.to_s
|
get :show, 'id' => @aspect0.id.to_s
|
||||||
assigns(:aspect).should == @aspect
|
assigns(:aspect).should == @aspect0
|
||||||
achash = @controller.send(:hashes_for_contacts, @aspect0.contacts).first
|
achash = @controller.send(:hashes_for_contacts, @aspect0.contacts).first
|
||||||
assigns(:aspect_contacts).first[:contact].should == achash[:contact]
|
assigns(:aspect_contacts).first[:contact].should == achash[:contact]
|
||||||
assigns(:aspect_contacts).first[:person].should == achash[:person]
|
assigns(:aspect_contacts).first[:person].should == achash[:person]
|
||||||
|
|
@ -105,7 +105,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
it "assigns contacts to only non-pending" do
|
it "assigns contacts to only non-pending" do
|
||||||
@user.contacts.count.should == 1
|
@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
|
@user.contacts.count.should == 2
|
||||||
|
|
||||||
get :show, 'id' => @aspect0.id.to_s
|
get :show, 'id' => @aspect0.id.to_s
|
||||||
|
|
@ -164,7 +164,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
it "assigns contacts to only non-pending" do
|
it "assigns contacts to only non-pending" do
|
||||||
@user.contacts.count.should == 1
|
@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
|
@user.contacts.count.should == 2
|
||||||
|
|
||||||
get :manage
|
get :manage
|
||||||
|
|
@ -251,7 +251,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
it 'has aspects' do
|
it 'has aspects' do
|
||||||
@hashes.length.should == 2
|
@hashes.length.should == 2
|
||||||
@hash[:aspect].should == @aspect
|
@hash[:aspect].should == @aspect0
|
||||||
end
|
end
|
||||||
it 'has a contact_count' do
|
it 'has a contact_count' do
|
||||||
@hash[:contact_count].should == @aspect0.contacts.count
|
@hash[:contact_count].should == @aspect0.contacts.count
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ describe StatusMessagesController do
|
||||||
{ :status_message => {
|
{ :status_message => {
|
||||||
:public =>"true",
|
:public =>"true",
|
||||||
:message =>"facebook, is that you?",
|
:message =>"facebook, is that you?",
|
||||||
:aspect_ids =>"#{aspect1.id}" }
|
},
|
||||||
}
|
:aspect_ids =>"#{aspect1.id}" }
|
||||||
}
|
}
|
||||||
it 'responds to js requests' do
|
it 'responds to js requests' do
|
||||||
post :create, status_message_hash.merge(:format => 'js')
|
post :create, status_message_hash.merge(:format => 'js')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue