filter on router

This commit is contained in:
Yaman Qalieh 2016-09-04 20:20:40 -04:00
parent a213cfde23
commit 3a9fd1ed0d

View File

@ -4,11 +4,11 @@ Router.route('/', {
this.redirect('/login'); this.redirect('/login');
} else { } else {
return [ return [
Meteor.subscribe('classes',this.params._id), Meteor.subscribe('classes', this.params._id),
Meteor.subscribe('schools',this.params._id), Meteor.subscribe('schools', this.params._id),
Meteor.subscribe('work',this.params._id), Meteor.subscribe('work', this.params._id),
Meteor.subscribe('requests',this.params._id), Meteor.subscribe('requests', this.params._id),
Meteor.subscribe('users',this.params._id) Meteor.subscribe('users', this.params._id)
]; ];
} }
}, },
@ -33,15 +33,15 @@ Router.route('/profile', {
this.redirect('/login'); this.redirect('/login');
} else { } else {
return [ return [
Meteor.subscribe('classes',this.params._id), Meteor.subscribe('classes', this.params._id),
Meteor.subscribe('schools',this.params._id), Meteor.subscribe('schools', this.params._id),
Meteor.subscribe('work',this.params._id), Meteor.subscribe('work', this.params._id),
Meteor.subscribe('requests',this.params._id), Meteor.subscribe('requests', this.params._id),
Meteor.subscribe('users',this.params._id) Meteor.subscribe('users', this.params._id)
]; ];
} }
}, },
action: function() { action: function() {
this.render("profile"); this.render("profile");
} }
}); });
@ -50,17 +50,17 @@ Router.route('/admin', {
waitOn: function() { waitOn: function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
return [ return [
Meteor.subscribe('classes',this.params._id), Meteor.subscribe('classes', this.params._id),
Meteor.subscribe('schools',this.params._id), Meteor.subscribe('schools', this.params._id),
Meteor.subscribe('work',this.params._id), Meteor.subscribe('work', this.params._id),
Meteor.subscribe('requests',this.params._id), Meteor.subscribe('requests', this.params._id),
Meteor.subscribe('users',this.params._id) Meteor.subscribe('users', this.params._id)
]; ];
} else { } else {
this.render('NotFound'); this.render('NotFound');
} }
}, },
action: function() { action: function() {
this.render("admin"); this.render("admin");
} }
}); });