2015-04-22 07:50:11 +09:00
|
|
|
Meteor.startup(function () {
|
|
|
|
|
2015-05-18 10:00:41 +09:00
|
|
|
Template.posts_daily.helpers({
|
2015-04-22 07:50:11 +09:00
|
|
|
days: function () {
|
|
|
|
var daysArray = [];
|
2015-07-08 16:00:27 +09:00
|
|
|
for (var i = 0; i < this.daysCount; i++) {
|
2015-04-22 07:50:11 +09:00
|
|
|
daysArray.push({
|
|
|
|
date: moment().subtract(i, 'days').startOf('day').toDate(),
|
|
|
|
index: i
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return daysArray;
|
|
|
|
},
|
|
|
|
context: function () {
|
2015-07-30 09:34:19 +09:00
|
|
|
var days = Template.parentData(1);
|
2015-05-02 14:06:22 +09:00
|
|
|
var context = {
|
|
|
|
terms: {
|
|
|
|
view: "singleday",
|
|
|
|
date: this.date,
|
|
|
|
after: moment(this.date).startOf('day').toDate(),
|
2015-07-07 18:50:09 +09:00
|
|
|
before: moment(this.date).endOf('day').toDate(),
|
2015-07-30 09:34:19 +09:00
|
|
|
enableCache: days.daysCount <= 15 ? true : false // only cache first 15 days
|
2015-05-02 14:06:22 +09:00
|
|
|
}
|
|
|
|
};
|
2015-04-22 07:50:11 +09:00
|
|
|
return context;
|
|
|
|
},
|
|
|
|
loadMoreDaysUrl: function () {
|
2015-07-08 16:00:27 +09:00
|
|
|
var count = parseInt(this.daysCount) + daysPerPage;
|
2015-04-22 07:50:11 +09:00
|
|
|
return '/daily/' + count;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|