Module: NavigationHelper

Defined in:
app/helpers/navigation_helper.rb

Instance Method Summary collapse

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


2
3
4
5
6
7
8
9
10
11
# File 'app/helpers/navigation_helper.rb', line 2

def nav_link(text, link_path, options = {}, &block)
  link_options = options.fetch(:link_options, {})
  link_options[:class] = link_classes(link_path, link_options)
  list_options = options.fetch(:list_options, {})

  inner = capture(&block)
  (:li, list_options) do
    concat(link_to(text.html_safe, link_path, link_options)).concat( block_given? ? inner : "" )
  end
end