Module: NavigationHelper
- Defined in:
- app/helpers/navigation_helper.rb
Instance Method Summary collapse
- #active_if_current_page(path, class_name = 'active') ⇒ Object
- #nav_link(text, link_path, options = {}, &block) ⇒ Object
Instance Method Details
#active_if_current_page(path, class_name = 'active') ⇒ Object
13 14 15 |
# File 'app/helpers/navigation_helper.rb', line 13 def active_if_current_page(path, class_name = 'active') current_page?(path) ? class_name : "" end |
#nav_link(text, link_path, options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/navigation_helper.rb', line 2 def nav_link(text, link_path, = {}, &block) = .fetch(:link_options, {}) [:class] = link_classes(link_path, ) = .fetch(:list_options, {}) inner = capture(&block) content_tag(:li, ) do concat(link_to(text.html_safe, link_path, )).concat( block_given? ? inner : "" ) end end |