Routing Namespaces - this.namespace() for defining routes#11308
Routing Namespaces - this.namespace() for defining routes#11308jmurphyau wants to merge 1 commit intoemberjs:masterfrom
Conversation
e68a6b7 to
2b78138
Compare
|
Just an FYI--With the big 2.0 push taking all the core team member's time, I imagine that's why there hasn't been a response from them. There are still features promised (routable components, etc) that haven't been delivered, so priorities and all that. I personally like the general idea--I've used a helper in the past to achieve the same result. |
|
Looks like this needs a rebase. I think in general I'm happy to land this behind a feature flag while things settle down for 2.0.0. |
|
@jmurphyau What is the intended rule for collisions? this.namespace('foo', function () {
this.route('bar');
});
this.route('foo', function () {
this.route('car');
});While obviously, one could say "don't do that", IMO that's not a good enough answer; the behavior should be defined and expected, even if that behavior is an exception or warning thrown. |
2b78138 to
50d5ec8
Compare
|
@rwjblue awesome - i'll get onto that. @jayphelps that an interesting scenario I haven't thought of.. not sure what it will do right now without any additional work but I would expect the I'll take a look into it |
44ca8e9 to
197f474
Compare
|
@jayphelps the default behaviour is that I've added tests to explicitly point out this behaviour. Also calls to |
There was a problem hiding this comment.
"namesapce" is misspelled 😄
197f474 to
610d327
Compare
…) for defining routes
Adds this.namespace() to Router DSL along side this.route() and this.resource().
The new namespace function allows you to define a set of routes that exist under the
one namespace which isn't a parent route.
The following 2 examples produce the same results:
this.route('admin.users', { path: 'admin/users' });
this.route('admin.groups', { path: 'admin/groups' });
this.route('admin.environments', { path: 'admin/environments' });
With this.namespace():
this.namespace('admin', function() {
this.route('users');
this.route('groups');
this.route('environments');
});
The above code examples create the following 3 routes:
1. `admin.users` at the URL `/admin/users`
2. `admin.groups` at the URL `/admin/groups`
3. `admin.environments` at the URL `/admin/environments`
This differs to nested routes in that the following routes are not created/resolved/used:
1. The parent route, `admin`
2. `admin.index`
3. `admin.error`
4. `admin.loading`
610d327 to
79c698e
Compare
|
@jayphelps @rwjblue any different or additional thoughts on this? Going to rebase it shortly - hopefully its good to go after that |
|
@jmurphyau - I think this needs to go through the RFC process. In general, I like this, but there are a few additional things that need to be fleshed out (that the RFC process is geared towards). Thank you very much for your work here, and I'm sorry for the crazy long delay here. |
Adds
this.namespace()to Router DSL along sidethis.route()andthis.resource().The new namespace function allows you to define a set of routes that exist under the
one namespace which isn't a parent route.
The following 2 examples produce the same results:
The above code examples create the following 3 routes:
admin.usersat the URL/admin/usersadmin.groupsat the URL/admin/groupsadmin.environmentsat the URL/admin/environmentsThis differs to nested routes in that the following routes are not created/resolved/used:
adminadmin.indexadmin.erroradmin.loading