2014-08-27 09:24:37 +09:00
|
|
|
Meteor.startup(function () {
|
|
|
|
|
2014-08-27 10:23:56 +09:00
|
|
|
var coreSubscriptions = new SubsManager({
|
|
|
|
// cache recent 50 subscriptions
|
|
|
|
cacheLimit: 50,
|
|
|
|
// expire any subscription after 30 minutes
|
|
|
|
expireIn: 30
|
|
|
|
});
|
|
|
|
|
2014-08-27 09:24:37 +09:00
|
|
|
Router.map(function() {
|
|
|
|
|
|
|
|
PostsDailyController = FastRender.RouteController.extend({
|
|
|
|
template: getTemplate('posts_daily'),
|
|
|
|
waitOn: function() {
|
|
|
|
// if number of days is set use that, else default to 3
|
|
|
|
var days = this.params.days ? this.params.days : 3,
|
|
|
|
terms = {
|
|
|
|
view: 'daily',
|
|
|
|
after: moment().subtract('days', days).startOf('day').toDate()
|
|
|
|
};
|
|
|
|
return [
|
|
|
|
coreSubscriptions.subscribe('postsList', terms),
|
|
|
|
coreSubscriptions.subscribe('postsListUsers', terms)
|
|
|
|
];
|
|
|
|
},
|
|
|
|
data: function() {
|
2014-08-27 10:23:56 +09:00
|
|
|
var days = this.params.days ? this.params.days : 3;
|
2014-08-27 09:24:37 +09:00
|
|
|
return {
|
2014-08-27 10:23:56 +09:00
|
|
|
days: days
|
2014-08-27 09:24:37 +09:00
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('posts_daily', {
|
|
|
|
path: '/daily/:days?',
|
|
|
|
controller: PostsDailyController
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|