twitter-bootstrap-rails icon indicating copy to clipboard operation
twitter-bootstrap-rails copied to clipboard

menu_item should not mark "chosen" items as "active"

Open markpmitchell opened this issue 9 years ago • 2 comments

When using the navbar helper, menu_item marks an item with the CSS "active" class if the menu item is either "active" (the current page) or "chosen" (the URI for the link is the first part of the current page). This seems wrong for several reasons:

  1. If there are menu items for "/posts" and "/posts/new", and the current page is "/posts/new", the "/posts" item should not be active.
  2. If there are menu items for "/post" and "/poster", and the current page is "/poster", the "/post" item should definitely not be active.

Therefore, is_active? should be changed simply to check current_page?(page). (current_page? is part of the Rails API.) uri_state is only used from is_active and could be deleted -- or, if necessary, retained as-is for backwards compatibility.

If the project maintainers agree, I am happy to make a pull request.

markpmitchell avatar May 22 '15 22:05 markpmitchell

:+1:

moregeek avatar Jun 25 '15 07:06 moregeek

:+1:

ammit avatar Jul 05 '15 20:07 ammit