Skip to content

Instantly share code, notes, and snippets.

@btbjosh
Last active August 31, 2015 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btbjosh/58fed60ec61cc4e775fc to your computer and use it in GitHub Desktop.
Save btbjosh/58fed60ec61cc4e775fc to your computer and use it in GitHub Desktop.
Route file for Meteor w/ Flow Router (w/ Roles)
// ROUTER GROUPS
var exposed, loggedIn, admin;
exposed = FlowRouter.group({});
loggedIn = FlowRouter.group({
triggersEnter: [
function(){
$('html, body').animate({ scrollTop: -10000 }, 100); // scroll to top on route change
}
]
});
admin = loggedIn.group({
prefix: '/admin',
triggersEnter: [
function(context, redirect) {
if (Meteor.user() && !Roles.userIsInRole(Meteor.user(), 'admin')) {
redirect('/');
}
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment