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

Propagating 'active' of linkTo to enclosing <li> #1822

Closed
sanfords opened this issue Jan 20, 2013 · 6 comments
Closed

Propagating 'active' of linkTo to enclosing <li> #1822

sanfords opened this issue Jan 20, 2013 · 6 comments

Comments

@sanfords
Copy link

The Bootstrap JS/CSS uses the existence of an 'active' class to determine if an item in a UI element should be highlighted. linkTo in ember can only add the 'active' class to the anchor it creates.

A few solutions have been proposed for this, most notably this stack overflow solution. Unfortunately, this solution breaks with {{#linkTo "index"}}... as in this jsbin based upon the original.

Within the IRC chat it was mentioned that some sort of {{activeWhen}} tag could be added to ember.

Anything that could be done to help with this issue would be most welcome. :-)

Thank you!

@nragaz
Copy link
Contributor

nragaz commented Jan 21, 2013

@sanfords FYI, using {{#linkTo index tagName="li"}}<a {{bindAttr href="view.href"}}>Index</a>{{/linkTo}} still works, although the output is invalid HTML.

@sanfords
Copy link
Author

That's a really neat idea. Thank you.

@jamesarosen
Copy link

You might also consider doing away with the <ol> and the <li>s altogether. You can style the <a>s as blocks, or even as list elements. Unless you're building something like Delicious and actually have lists of links, the <li>s might not be semantically correct anyway. I personally like <nav><a href="/about">About</a>...</nav> for main menus.

@sanfords
Copy link
Author

You are correct. However I'm using the comprehensive Bootstrap library to build up my UI. And it uses class="active" in the

  • block.

  • @sanfords
    Copy link
    Author

    More discussion here: #1849

    @sanfords
    Copy link
    Author

    I'm going to close this so we can move the discussion to 1849.

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

    No branches or pull requests

    3 participants