New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/route to string #306
Conversation
One request: Would it be possible to disable the auto code formatting? It's kind of hard to tell what actually changed if the diff shows all the tabs and spaces that got modified. I'll run everything through a beautifier for 1.2 so that things will be more consistent. |
This reverts commit 5619e29.
@daffl Reverted commit, hope it is fine now. |
Had some issue with merging canjs master into this branch. |
Yes, sorry didn't have a chance to really look at this. Could you maybe also explain the reason for the string conversion a little more? I can see from the tests where this is going but am not sure why it would be necessary. Thanks! |
I noticed this as problem in my app, where i keep current state of page in hash params. Most of them are key - value where value is integer (id of something).
<% something.each(function(smth) { %>
<div class="<% can.route.attr('something_id') === smth.id ? "active" : "" %>" <%= (el) -> el.data('smth', smth) %>>
<%= smth.name %>
</div>
<% }) %> Then in control {
init: function() {},
"div.click": function(el, ev) {
can.route.attr('something_id', el.data('smth').id)
},
"{can.route} something_id": function(route, ev, what, somethingId) {
if(somethingId) {
$.ajax('something/' + somethingId)
}
}
} So this is usecase. When i have app in zero state and click on something div it sets something_id = 1 (integer) in can.route. But what happend when i do refresh with something_id parameter sets. |
This is a good idea. We should review this and get it in for 1.2 |
Couldn't merge, but implemented your suggestion, worked like a charm. Closing up on this. |
Good to hear guys .) |
It is almost same pull request as #272 but the second one is from master branch, what is completely wrong (i have never done pull request before :) )
I improve the stringifiing part of this feature and add test for this. It is used in our current project for more than 2 weeks and it looks fine and working.