2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('posts_list')].helpers({
|
2014-07-05 11:42:28 +09:00
|
|
|
post_item: function () {
|
|
|
|
return getTemplate('post_item');
|
|
|
|
},
|
2013-10-29 16:55:59 +09:00
|
|
|
posts : function () {
|
2014-05-01 13:10:34 -07:00
|
|
|
if(this.postsList){ // XXX
|
|
|
|
this.postsList.rewind();
|
|
|
|
var posts = this.postsList.map(function (post, index, cursor) {
|
|
|
|
post.rank = index;
|
|
|
|
return post;
|
|
|
|
});
|
|
|
|
return posts;
|
|
|
|
}
|
2013-10-29 16:55:59 +09:00
|
|
|
},
|
2013-10-29 17:05:20 +09:00
|
|
|
hasMorePosts: function(){
|
|
|
|
// as long as we ask for N posts and all N posts showed up, then keep showing the "load more" button
|
|
|
|
return parseInt(Session.get('postsLimit')) == this.postsCount
|
2013-10-24 21:09:52 +09:00
|
|
|
},
|
|
|
|
loadMoreUrl: function () {
|
|
|
|
var count = parseInt(Session.get('postsLimit')) + parseInt(getSetting('postsPerPage', 10));
|
|
|
|
var categorySegment = Session.get('categorySlug') ? Session.get('categorySlug') + '/' : '';
|
|
|
|
return '/' + Session.get('view') + '/' + categorySegment + count;
|
2012-12-20 21:17:07 +01:00
|
|
|
}
|
2014-07-18 09:18:52 +09:00
|
|
|
});
|