Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Menu Library / API Refactor #120

cliftonc opened this Issue Oct 1, 2011 · 0 comments


None yet
1 participant

cliftonc commented Oct 1, 2011

Ok, the menu library really isn't very great at the moment - I think we need another crack at making it actually useful.


  • At the moment menus are defined in calipso.js, hence not configurable.
  • They are decoupled from routes (may be good or bad!) and so require you to configure routes and corresponding menu links yourself.
  • Menu generation is then not very configurable as it is pretty much 'give me the whole menu tree for this menu please' and thats it.

So, my thoughts (this is discussion so please add):


Menus should be added via route configuration, so where currently we have

 res.menu.admin.addMenuItem({name:'Administration',path:'admin',url:'/admin',description:'Calipso administration ...',security:[]});

// Core Administration dashboard
module.router.addRoute('GET /admin', showAdmin, {
  template: 'admin',
  block: 'admin.show',
  admin: true
}, this.parallel());

We would instead have something like:

// Core Administration dashboard
module.router.addRoute('GET /admin', showAdmin, {
  template: 'admin',
  block: 'admin.show',
  description:'Calipso administration ...',
  security:['admin'] // to be implemented
}, this.parallel());

Where, the menu option will be of the following format:


The prefix of menuname allows you to specify which menu it should be added to, while the path allows it to be generated in relation to all other menu items.

Menu generation would then be something like:

calipso.menu.render = function(req, menuName, startAt, depth) // req is required for security vs current user

And exposed via a helper:


Also, we could later add an 'alias' type module that enables other menu items and aliases to be matched to existing routes ... need to give that thought in a separate thread.

It would be created via the module router, but there would be a single, central menu object that spans all modules via calipso.menu.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment