Added current page info to endless scroll

This commit is contained in:
Marcin Kurczewski
2014-10-20 20:30:13 +02:00
parent 20d75e177d
commit 72bd4c479a
10 changed files with 40 additions and 49 deletions

View File

@ -43,8 +43,8 @@ App.Presenters.PostListPresenter = function(
baseUri: '#/posts',
backendUri: '/posts',
$target: $el.find('.pagination-target'),
updateCallback: function(data, clear) {
renderPosts(data.entities, clear);
updateCallback: function($page, data) {
renderPosts($page, data.entities);
},
},
function() {
@ -102,13 +102,8 @@ App.Presenters.PostListPresenter = function(
_.map($el.find('.posts .post-small'), function(postNode) { softRenderPost(jQuery(postNode).parents('li')); });
}
function renderPosts(posts, clear) {
var $target = $el.find('.posts');
if (clear) {
$target.empty();
}
function renderPosts($page, posts) {
var $target = $page.find('.posts');
_.each(posts, function(post) {
var $post = renderPost(post);
softRenderPost($post);