seyhunak / twitter-bootstrap-rails

Twitter Bootstrap for Rails 6.0, Rails 5 - Rails 4.x Asset Pipeline
https://github.com/seyhunak/twitter-bootstrap-rails
4.5k stars 999 forks source link

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

Open markpmitchell opened 9 years ago

markpmitchell commented 9 years ago

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.

moregeek commented 9 years ago

:+1:

ammit commented 9 years ago

:+1: