mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00
50 lines
No EOL
1.2 KiB
JavaScript
50 lines
No EOL
1.2 KiB
JavaScript
var coreSubscriptions = new SubsManager({
|
|
// cache recent 50 subscriptions
|
|
cacheLimit: 50,
|
|
// expire any subscription after 30 minutes
|
|
expireIn: 30
|
|
});
|
|
|
|
// note: FastRender not defined here?
|
|
|
|
PostsDailyController = RouteController.extend({
|
|
template: getTemplate('posts_daily'),
|
|
onBeforeAction: function() {
|
|
this.days = this.params.days ? this.params.days : 3;
|
|
// this.days = Session.get('postsDays') ? Session.get('postsDays') : 3;
|
|
|
|
var terms = {
|
|
view: 'daily',
|
|
days: this.days,
|
|
after: moment().subtract(this.days, 'days').startOf('day').toDate()
|
|
};
|
|
|
|
this.postsSubscription = coreSubscriptions.subscribe('postsList', terms, function() {
|
|
Session.set('postsLoaded', true);
|
|
});
|
|
|
|
this.postsUsersSubscription = coreSubscriptions.subscribe('postsListUsers', terms);
|
|
|
|
return [this.postsSubscription, this.postsUsersSubscription];
|
|
|
|
},
|
|
data: function() {
|
|
Session.set('postsDays', this.days);
|
|
return {
|
|
days: this.days
|
|
};
|
|
}
|
|
});
|
|
|
|
Meteor.startup(function () {
|
|
|
|
Router.map(function() {
|
|
|
|
this.route('postsDaily', {
|
|
path: '/daily/:days?',
|
|
controller: PostsDailyController
|
|
});
|
|
|
|
});
|
|
|
|
}); |