ms iz made the aspect stream ajax in
This commit is contained in:
parent
f9172c8733
commit
d36da2a266
3 changed files with 20 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module StreamHelper
|
||||
def next_page_path
|
||||
def next_page_path(opts ={})
|
||||
if controller.instance_of?(TagsController)
|
||||
tag_path(@tag, :max_time => @posts.last.created_at.to_i)
|
||||
elsif controller.instance_of?(AppsController)
|
||||
|
|
@ -13,7 +13,13 @@ module StreamHelper
|
|||
elsif controller.instance_of?(TagFollowingsController)
|
||||
tag_followings_path(:max_time => @stream.posts.last.created_at.to_i)
|
||||
elsif controller.instance_of?(AspectsController)
|
||||
aspects_path(:max_time => @stream.posts.last.send(@stream.order.to_sym).to_i, :a_ids => @stream.aspect_ids)
|
||||
if opts[:ajax_stream]
|
||||
time = (Time.now() + 1).to_i
|
||||
|
||||
else
|
||||
time = @stream.posts.last.send(@stream.order.to_sym).to_i
|
||||
end
|
||||
aspects_path(:max_time => time, :a_ids => @stream.aspect_ids)
|
||||
else
|
||||
raise 'in order to use pagination for this new controller, update next_page_path in stream helper'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,12 @@
|
|||
|
||||
.span-13.append-1
|
||||
#aspect_stream_container.stream_container
|
||||
= render 'aspects/aspect_stream', :stream => @stream
|
||||
|
||||
= render 'shared/publisher', :selected_aspects => @stream.aspects, :aspect_ids => @stream.aspect_ids, :for_all_aspects => @stream.for_all_aspects?, :aspect => @stream.aspect
|
||||
#main_stream.stream{:data => {:guids => @stream.aspect_ids.join(',')}}
|
||||
#pagination
|
||||
=link_to(t('more'), next_page_path(:ajax_stream => true), :class => 'paginate')
|
||||
/= render 'aspects/aspect_stream', :stream => @stream
|
||||
|
||||
.span-5.rightBar.last
|
||||
= render 'aspects/selected_contacts', :stream => @stream
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
var newPath = pathStr.replace("?", "?only_posts=true&"),
|
||||
lastTime = $('#main_stream .stream_element').last().find(".time").attr("integer");
|
||||
|
||||
if(lastTime === undefined){
|
||||
var currentTime = new Date,
|
||||
unixtimeMs = currentTime.getTime(),
|
||||
lastTime = parseInt(unixtimeMs / 1000);
|
||||
}
|
||||
|
||||
return newPath.replace(/max_time=\d+/, "max_time=" + lastTime);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue