url-for helper#92
Conversation
|
👍 - I personally prefer 'url-for' (because this is useful for more things than just hrefs). I'd also like to see a 'url-is-active' helper for similar reasons (it could fit in this RFC, but I'm fine with it being a separate one also). |
|
Also, I'd like to see Ember.LinkComponent be changed around to provide all of its functionality via public template helpers (possibly when it is implemented as a glimmer component). This 'url-for'/'href-to' helper is a great start towards that goal... |
|
Thanks, I agree that |
text/0000-href-to.md
Outdated
There was a problem hiding this comment.
wouldn't the solution to ^ be to make link-to not slow? This seems like it would have a much greater impact.
There was a problem hiding this comment.
Yes, the faster that link-to is, the less our need for something like this. We've found the href-to addon to be 6-12x times faster in Ember 1.11-1.13 though. link-to will always have much more to do, all href-to has to do is to generate a URL.
There was a problem hiding this comment.
We should definitely make link-to faster, but the two ideas are not opposed to each other. For example, one way to make it faster is to have it take advantage of template helpers like this one.
There was a problem hiding this comment.
my point was, we don't normally except joe turbo features, when the core primitive is still more or less unoptimized. So that being a primary motivation may give the wrong impression.
As i mentioned, the more compelling motivation should be to de-sugar link-to, this will:
- prevent link-to from continuing to be a junk drawer
- allow us to use new templating features to make the component parts faster (but they should also then in-tern make link-to better/faster)
- enable more experimentation
There was a problem hiding this comment.
I'll rewrite the motivation section to emphasise these points. Thanks
|
I suspect a sibling RFC (or maybe part of this one) should explore the extracting other parts of link to. Such as the classes that are associated with a URL. active/loading/current etc. The reason i suggest this, is to ensure a uniform experience between the component parts. With that in-place, link-to may easily just become a sugaring of its component parts. It could even become just an HTMLBars transform, with nearly no overhead. All while exposing the building blocks as public api. |
|
I've renamed the helper to In order to keep it small, I've kept this focused on |
text/0000-url-for.md
Outdated
There was a problem hiding this comment.
Slight nit-pick: I personally wouldn't call this a relative url since it includes a leading slash.
👍 |
|
Awesome first step. My feeling is that this functionality should likely be specced out as part of a |
|
This will make links within i18n strings much easier so 👍 . For example we use a i18n string format based on Java xmsg (Yahoo uses something similar but standardized) and our helper looks something like. Definitely a need for this type of primitive. |
|
I was thinking the same. Let's build on top of the routingService. |
|
has there been any progress on this? I need a similar solution to what @chadhietala described and it would be awesome if ember would provide this out of the box. |
|
Closing this in favor of #95. Thanks for opening @GavinJoyce, hoping to land the router service RFC which should include this helper soon. |
blueprint remove old files
Link to rendered