Skip to content
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

Need route-active sexpr for finer-grained control over whether a route is active #4447

Closed
beerlington opened this issue Feb 28, 2014 · 5 comments
Assignees
Labels

Comments

@beerlington
Copy link

I'm not sure if this is a bug, expected behavior, or I'm just misusing the "clearing" functionality for query-params-new. When I clear the params on a link-to helper by passing false for the values, the index link is no longer active when params are used in other links within the index template.

That description isn't great, but if you look at the following example, you'll see that the Dogs index link is no longer active when a "name" or "breed" parameter is active. This is not the case for the Cats index link. I would expect the Dogs link to remain active since I am still within the DogsRoute.

http://emberjs.jsbin.com/zopixugo/1

@rwjblue
Copy link
Member

rwjblue commented Feb 28, 2014

@beerlington - FYI - it is my understanding that sticky query-params are going to be removed in the next iteration.

@machty / @raytiley would know more details on that.

@machty
Copy link
Contributor

machty commented May 19, 2014

@beerlington sorry it took me so long to get around to this, but I understand what you're asking and I'm having trouble thinking of the right solution... seems like we're caught between two desirable behaviors for taking provided query param values into account when computing whether a link is active.

If you had a paginated list of articles, and you were on page 2, and page were a QP, then you wouldn't generally want a link back to page 1, the default QP value, to be considered active. But in your case, you do?

I think the full solution to this involves using an s-expression helper that you can pass in as a value to active= in the link-to helper. We've talked about wanting this and I think this is the right use case.

In the meantime, you can do the following hacky thing: http://jsbin.com/zopixugo/4/edit

@machty machty added feature and removed bug labels May 19, 2014
@machty machty changed the title query-params-new : Index route links not active when clearing sticky params Need route-active sexpr for finer-grained control over whether a route is active May 19, 2014
@machty
Copy link
Contributor

machty commented Jun 13, 2014

Closing this as we have an API to support this use case on master now; we can discuss a feature proposal for this at discuss.emberjs.com if it makes sense.

Example of all the ways you can configure QPs: http://jsbin.com/ucanam/5379

@machty machty closed this as completed Jun 13, 2014
@beerlington
Copy link
Author

👍 thanks for all the hard work, very much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants