Module: RailsNavigationHelper
- Defined in:
- app/helpers/rails_navigation_helper.rb
Instance Method Summary collapse
- #matches_page?(conditions) ⇒ Boolean
- #nav_to(name, path, conditions = nil, html_options = {}) ⇒ Object
Instance Method Details
#matches_page?(conditions) ⇒ Boolean
2 3 4 |
# File 'app/helpers/rails_navigation_helper.rb', line 2 def matches_page?(conditions) RailsNavigation::Matcher.match_multiple_with_or?(controller_name, action_name, params, conditions) end |
#nav_to(name, path, conditions = nil, html_options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/rails_navigation_helper.rb', line 6 def nav_to(name, path, conditions = nil, = {}) active_class = [] active_class = ['active'] if matches_page?(conditions) if [:class] custom_classes = *[:class] classes = active_class + custom_classes else classes = active_class end [:class] = classes content_tag(:li, link_to(name, path), ) end |