Skip to content

Instantly share code, notes, and snippets.

@czbaker
Created January 15, 2015 16:08
Show Gist options
  • Save czbaker/a6888222350ddd0c1e69 to your computer and use it in GitHub Desktop.
Save czbaker/a6888222350ddd0c1e69 to your computer and use it in GitHub Desktop.
Router.configure({
layoutTemplate: 'appLayout'
});
//
Router.route('/', function() {
this.render('home');
}, {
name: 'home'
});
// Channel Admin (User)
Router.route('/dashboard', function() {
this.render('dashboard');
}, {
name: 'dashboard'
});
// Global Admin (Admins only)
Router.route('/admin/', function() {
this.render('admin');
}, {
name: 'admin'
});
// Global hook for requiring login, except front page and about.
Router.onBeforeAction(function() {
// If not logged in, tell the person they must be, otherwise continue.
if (!Meteor.userId()) {
this.render('loginRequired');
} else {
this.next();
}
}, {
except: ['home']
});
// Set page title, because...Iron-Router is silly?
Router.onAfterAction(function() {
// Eventually, I'll have this change with page location somehow.
document.title = "WASDBot";
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment