Vulcan/client/views/posts/posts_digest.js
2012-10-10 13:54:48 +09:00

30 lines
No EOL
927 B
JavaScript

Template.posts_digest.helpers({
posts: function(){
var postsView=sessionGetObject('postsView');
var collection=Posts.find(postsView.find);
return collection;
},
currentDate: function(){
return moment(sessionGetObject('currentDate')).format("dddd, MMMM Do YYYY");
},
previousDateURL: function(){
var currentDate=moment(sessionGetObject('currentDate'));
var newDate=currentDate.subtract('days', 1);
return getDigestURL(newDate);
},
showPreviousDate: function(){
// TODO
return true;
},
nextDateURL: function(){
var currentDate=moment(sessionGetObject('currentDate'));
var newDate=currentDate.add('days', 1);
return getDigestURL(newDate);
},
showNextDate: function(){
var currentDate=moment(sessionGetObject('currentDate'));
var nextDate=currentDate.add('days', 1);
var today=moment(new Date());
return today.diff(nextDate, 'days') > 0
}
});