[FEATURE ember-routing-multi-current-when] link-to currentWhen can handle multiple routes#3673
[FEATURE ember-routing-multi-current-when] link-to currentWhen can handle multiple routes#3673rwjblue merged 1 commit intoemberjs:masterfrom gpoitch:current-when-multi
Conversation
|
this would also be a feature, and should be marked and flagged as such. see: http://emberjs.com/guides/configuring-ember/feature-flags/ |
|
@gdub22 can you add the tag as @stefanpenner requested? We'll also need to discuss this with the core team. |
|
Feature flagged |
|
@gdub22 Why was this closed ? |
|
@hyderali Accidentally got blown away during some housekeeping. Can redo if interested. |
|
@gdub22 , Yeah, in need of this in my current project, and will be of great help, if this comes built-in. |
|
Also would find incredibly useful, love it if this could be included in Ember.js core. |
|
ping @gdub22 I believe this a useful addition to ember-core. |
|
@gdub22 This needs to be rebased. |
|
@rjackson Did this get discussed in core? |
|
👍 This would be awesome |
|
There's something un-HTML-like about camelBack case: CSS sets the precedence for mulitple word attribute names, really. For example: word-wrap, or border-radius, etc. Also agree with @rjackson that space would be a better sub-string delimeter within attribute value (mulitple CSS classnames sets the precedence there). |
|
@JulianLeviston agreed, space is way more consistent with other things in ember whereas the pipe delimiter AFAIK is not used anywhere else. |
|
I don't see how that CSS argument applies to this feature. My original thought is the pipe helps represent an 'or' operator, although it actually reads as a bitwise operator. One thing to note is that a route name with a space is actually valid. So is a pipe, but probably far less commonly used. Definitely all for consistency. |
|
@gdub22 yes I also don't see how the css argument applies. Routes are (generally) camelcased, and the currentWhen property accepting multiple routes doesn't apply here. I didn't realize that routes with spaces in were valid. Perhaps they shouldn't be valid? |
|
The argument is that this is a template helper, so similar rules to HTML should apply, IMHO. BTW, no disrespect intended, gdub22. Your approach is very understandable and one can easily see why you chose what you chose. |
|
@JulianLeviston not sure if you mean the rules should apply to the name "currentWhen" or the arguments "fooRoute|barRoute", however neither makes sense - the name of the property is a javascript property that you are setting on the view and the arguments are route names. If you disagree about either of these naming conventions in ember this ticket is not the right place to argue for a change because those conventions apply throughout ember and handlebars, not just to this helper. |
|
@JulianLeviston no worries :) All unicode characters seem to be valid in route names. |
|
all good :) |
|
@rjackson , any updates on this ? |
|
I would love to be able to use this. 👍 |
|
Just a hunch regarding the route list separator— Handlebars.helper('list', function (...items, options) { return items; }); |
|
Happy to merge and deliberate while it remains behind a feature flag. |
|
Working on rebasing... that code changed a lot. |
|
@gdub22 - Yeah, the query-params stuff likely affected this area quite a bit. Sorry for taking so long in getting back to you, but thanks for working on this. |
[FEATURE ember-routing-multi-current-when] link-to currentWhen can handle multiple routes
|
Thanks! |
|
Following the EmberJS Change Log, the feature is included since EmberJS 1.6.0 release, right? I tried it. When I setup my .hbs template like in the first post {{#link-to 'about' currentWhen='about|team'}}About{{/link-to}}, I get an error message "Uncaught Error: There is no route named about|team". Ember doesn't seem to be able to resolve the routes correctly or to interpret them as two routes. Neither a pipe, a blank as a separator nor (list 'about' 'team') is working here. Did there anything change with the syntax in the meanwhile. I am a little bit confused. I am using EmberJS 1.6.1. Thank you very much for any hints! |
|
@coachTomato This feature is not in 1.6.0. You have to use a canary build and enable the feature flag |
|
Ah, ok, I'll try that. |
|
We discussed this at the core team meeting. We are go on the feature, but would like to change the syntax to be space-delimited instead of pipe-delimited. |
|
@rwjblue will work on the patch this weekend when prepping the new releases. |
|
@tomdale: Great news. I have no problem to change the syntax to space-delimited in my code. |
|
👍 Space-delimited seems more consistent with Ember's other features. |
|
@trek - This was already done, and is included in 1.8.0-beta.1 (with a space delimited list). |
|
Was updated and enabled in #5387. |
Expanding upon the
link-tohelper's currentWhen property to support multiple routes, using a pipe delimiter.