Vulcan/packages/telescope-daily/lib/client/templates/posts_daily.js

24 lines
866 B
JavaScript
Raw Normal View History

2014-08-27 09:24:37 +09:00
Template[getTemplate('postsDaily')].helpers({
post_item: function () {
return getTemplate('post_item');
},
posts : function () {
if(this.postsList){ // XXX
this.postsList.rewind();
var posts = this.postsList.map(function (post, index, cursor) {
post.rank = index;
return post;
});
return posts;
}
},
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
},
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;
}
});