If you have some root level HTML that is present on "almost" every screen, where/how would you organize this?
I'm using backbone-boilerplate and requirejs. One of the root level views is a global navigation element that can be invoked from the bottom of the screen at any time.
This is organized in a module that has a model (for visibility, the selected state, the log of clicks, etc). The app is stored in:
ClientName.app = _.extend( { rootViews: {} }, Backbone.Views);
Then in my routers initialize method, i have:
ClientName.app.rootViews.globalNav = new GlobalNav.Views.BottomView({ model: new GlobalNav.Models.Bottom()});
It works fine, but as the functionality is growing, the routers initialize method is getting out of hand with similar root views, sub routers, etc. Am I totally missing something?
What would you recommend?
No comments:
Post a Comment