I have an application that I want to create using Backbone Marionette. Basically, it's UI structure is very simple. There are:
- Two top level regions, one for the menu, the other for the content
- The menu region shows a menu view
- The content region shows two views next to each other
- The left one is for a sub-navigation
- The right one is for the actual content
As an example, the menu might switch between two parts of the application, such as "mail", "calendar" and "contacts". Each of those parts has its own sub-navigation which shall be shown in sub-navigation view, and each part has a default view. E.g., in the "mail" part this may be the "inbox" view, in the "calendar" part this may be the "month" view.
So, generally, we have a nested navigation.
How do I implement this using routers?
My idea is to have an application-level router that just provides routes for the parts such as #mail
and #calendar
.
The sub-navigation views then should have their own routers. So, e.g., the mail sub-navigation view could have a router for inbox
and sent
.
In the end I want to have a route such as #mail/inbox
, but the first part should be handled by the top-level router, the second part should be handled by the sub-level router.
My question is whether I can nest routers in a way that the sub-level routers do not need to know the URL prefix such as "mail", and there is a cascading routing happening. Is this possible?
Or is this approach completely wrong?