Vulcan/packages/telescope-daily/lib/routes.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-09-01 09:52:40 +09:00
var daysPerPage = 5;
2014-08-28 10:16:17 +09:00
var coreSubscriptions = new SubsManager({
// cache recent 50 subscriptions
cacheLimit: 50,
// expire any subscription after 30 minutes
expireIn: 30
});
PostsDailyController = RouteController.extend({
template: function() {
return getTemplate('postsDaily');
},
subscriptions: function () {
this.days = this.params.days ? this.params.days : daysPerPage;
// 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);
},
data: function () {
Session.set('postsDays', this.days);
return {
days: this.days
};
2014-11-27 17:25:01 +05:30
},
getTitle: function () {
return i18n.t('daily') + ' - ' + getSetting('title', "Telescope");
},
getDescription: function () {
return i18n.t('day_by_day_view');
},
2014-11-27 17:25:01 +05:30
fastRender: true
});
2014-08-28 10:16:17 +09:00
Meteor.startup(function () {
2014-08-27 10:23:56 +09:00
2014-11-17 14:53:42 +09:00
Router.route('/daily/:days?', {
name: 'postsDaily',
controller: PostsDailyController
2014-08-27 09:24:37 +09:00
});
});