Fixed list presenters not scrolling to top

This commit is contained in:
Marcin Kurczewski 2014-10-22 19:14:42 +02:00
parent 619a0c0cc4
commit eed2588eb7
4 changed files with 6 additions and 2 deletions

View file

@ -33,7 +33,7 @@ App.Presenters.GlobalCommentListPresenter = function(
backendUri: '/comments', backendUri: '/comments',
$target: $el.find('.pagination-target'), $target: $el.find('.pagination-target'),
updateCallback: function($page, data) { updateCallback: function($page, data) {
renderPosts($page, data.entities); renderComments($page, data.entities);
}, },
}, },
function() { function() {
@ -59,7 +59,7 @@ App.Presenters.GlobalCommentListPresenter = function(
$el.html(templates.list()); $el.html(templates.list());
} }
function renderPosts($page, data) { function renderComments($page, data) {
var $target = $page.find('.posts'); var $target = $page.find('.posts');
_.each(data, function(data) { _.each(data, function(data) {
var post = data.post; var post = data.post;
@ -84,6 +84,7 @@ App.Presenters.GlobalCommentListPresenter = function(
$target.append($post); $target.append($post);
}); });
window.scrollTo(0, 0);
} }
return { return {

View file

@ -113,6 +113,7 @@ App.Presenters.PostListPresenter = function(
} }
}); });
windowResized(); windowResized();
window.scrollTo(0, 0);
} }
function shouldSkipPost(post) { function shouldSkipPost(post) {

View file

@ -120,6 +120,7 @@ App.Presenters.TagListPresenter = function(
})); }));
$target.append($item); $target.append($item);
}); });
window.scrollTo(0, 0);
} }
return { return {

View file

@ -78,6 +78,7 @@ App.Presenters.UserListPresenter = function(
$target.append($item); $target.append($item);
}); });
_.map(_.map($target.find('img'), jQuery), util.loadImagesNicely); _.map(_.map($target.find('img'), jQuery), util.loadImagesNicely);
window.scrollTo(0, 0);
} }
return { return {