2012-10-10 13:54:48 +09:00
|
|
|
Template.posts_digest.helpers({
|
|
|
|
posts: function(){
|
2012-10-18 13:07:10 +11:00
|
|
|
return digestPosts();
|
2012-10-09 12:02:37 +09:00
|
|
|
},
|
2012-10-19 09:05:02 +09:00
|
|
|
hasPosts: function(){
|
|
|
|
return !!digestPosts().length;
|
|
|
|
},
|
2012-10-10 13:54:48 +09:00
|
|
|
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(){
|
2012-10-22 14:00:47 +09:00
|
|
|
var currentDate=moment(sessionGetObject('currentDate')).startOf('day');
|
2012-10-22 14:05:49 +09:00
|
|
|
var today=moment(new Date()).startOf('day');
|
2012-10-22 14:00:47 +09:00
|
|
|
return today.diff(currentDate, 'days') > 0
|
2012-10-09 12:02:37 +09:00
|
|
|
}
|
2012-10-22 09:28:42 +09:00
|
|
|
});
|
|
|
|
|
2012-10-22 14:00:47 +09:00
|
|
|
Template.posts_digest.created = function(){
|
|
|
|
var currentDate=moment(sessionGetObject('currentDate')).startOf('day');
|
|
|
|
var today=moment(new Date()).startOf('day');
|
2012-10-22 09:28:42 +09:00
|
|
|
$(document).bind('keydown', 'left', function(){
|
|
|
|
Router.navigate(getDigestURL(currentDate.subtract('days', 1)), {trigger: true});
|
|
|
|
});
|
|
|
|
$(document).bind('keydown', 'right', function(){
|
2012-10-22 14:00:47 +09:00
|
|
|
if(today.diff(currentDate, 'days') > 0)
|
|
|
|
Router.navigate(getDigestURL(currentDate.add('days', 1)), {trigger: true});
|
2012-10-22 09:28:42 +09:00
|
|
|
});
|
|
|
|
};
|