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

@ -78,10 +78,10 @@ App.Presenters.PostCommentListPresenter = function(
privileges)));
$el.find('.comment-add form button[type=submit]').click(function(e) { commentFormSubmitted(e, null); });
renderComments(comments, true);
renderComments(comments);
}
function renderComments(comments, clear) {
function renderComments(comments) {
var $target = $el.find('.comments');
var $targetList = $el.find('ul');
@ -91,10 +91,7 @@ App.Presenters.PostCommentListPresenter = function(
$target.hide();
}
if (clear) {
$targetList.empty();
}
$targetList.empty();
_.each(comments, function(comment) {
renderComment($targetList, comment);
});
@ -206,7 +203,7 @@ App.Presenters.PostCommentListPresenter = function(
promise.wait(api.delete('/comments/' + comment.id))
.then(function(response) {
comments = _.filter(comments, function(c) { return c.id !== comment.id; });
renderComments(comments, true);
renderComments(comments);
}).fail(showGenericError);
}