Skip to content

Instantly share code, notes, and snippets.

@fritz-gerneth
Created April 2, 2013 14:26
Show Gist options
  • Save fritz-gerneth/5292613 to your computer and use it in GitHub Desktop.
Save fritz-gerneth/5292613 to your computer and use it in GitHub Desktop.
Meteor.startup(function () {
"use strict";
// GLOBAL
var routes = {};
var router = new Meteor.PageRouter();
var navKeyFunc = function () {
return router.nav();
};
// AUTH
var requireLogin = function () {
if (_.isNull(Meteor.user())) {
this.redirect('/account/authentication');
this.isDone();
}
};
var requireNoLogin = function () {
if (!_.isNull(Meteor.user())) {
this.redirect('/account/');
this.isDone();
}
};
routes['/account/authentication'] = {to: 'authentication.index', layout: 'authentication.layout', before: [requireNoLogin]};
// ACCOUNT
routes['/account'] = {to: 'account.index', layout: 'account.layout', nav: 'account.index', before: [requireLogin]};
routes['/account/projects'] = {to: 'projects.account.list', layout: 'account.layout', nav: 'account.projects', before: [requireLogin]};
var accountNavigation = new InnoAccel.Navigation.Container();
accountNavigation.addChild(
new InnoAccel.Navigation.MPEntry({
'href': '/account/',
'label': 'Profile',
'navValue': 'account.index',
'iconClass': 'icon-cogs'
})
);
accountNavigation.addChild(
new InnoAccel.Navigation.MPEntry({
'href': '/account/projects',
'label': 'Projects',
'navValue': 'account.projects',
'iconClass': 'icon-book'
}, navKeyFunc)
);
Template['account.sidebar'].accountMenu = new InnoAccel.Navigation.Helper.Menu(accountNavigation, {
ulClass: 'nav nav-tabs nav-stacked'
}, [InnoAccel.Navigation.Filter.All], ['iconClass']);
// ROUTING
router.pages(routes);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment