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

@ -32,8 +32,8 @@ App.Presenters.GlobalCommentListPresenter = function(
baseUri: '#/comments',
backendUri: '/comments',
$target: $el.find('.pagination-target'),
updateCallback: function(data, clear) {
renderPosts(data.entities, clear);
updateCallback: function($page, data) {
renderPosts($page, data.entities);
},
},
function() {
@ -59,13 +59,8 @@ App.Presenters.GlobalCommentListPresenter = function(
$el.html(templates.list());
}
function renderPosts(data, clear) {
var $target = $el.find('.posts');
if (clear) {
$target.empty();
}
function renderPosts($page, data) {
var $target = $page.find('.posts');
_.each(data, function(data) {
var post = data.post;
var comments = data.comments;