diff --git a/lib/routes/admin.js b/lib/routes/admin.js index eb544cb..2fa8444 100644 --- a/lib/routes/admin.js +++ b/lib/routes/admin.js @@ -1,21 +1,23 @@ AdminController = RouteController.extend({ subscriptions: function () { - return Meteor.subscribe('flagsList', Session.get('itemsLimit')); + var limit = Meteor.isClient && this.state.get('itemsLimit') || 15; + return Meteor.subscribe('flagsList', limit); }, onBeforeAction: function () { - if (!Meteor.userId() || !isAdmin(Meteor.user())) { + var userId = Meteor.userId(); + if (!isAdminById(userId)) { this.redirect('home'); } this.next(); }, onRun: function () { - Session.set('itemsLimit', 1); + this.state.set('itemsLimit', 15); this.next(); }, action: function () { if (this.ready()) { - this.render(); this.render('nav', { to: 'nav' }); + this.render(); } } });