Created
January 15, 2015 16:08
-
-
Save czbaker/a6888222350ddd0c1e69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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