Module: Skyline::MenuHelper

Defined in:
app/helpers/skyline/menu_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_menu_scope(scope) ⇒ Object



21
22
23
# File 'app/helpers/skyline/menu_helper.rb', line 21

def current_menu_scope(scope)
  (@_menu_scope || []) + scope
end

Parameters:

  • scope (Array)
  • url (String, Hash)
  • options (Hash)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/skyline/menu_helper.rb', line 6

def menu_item(*scope)
  scope = Array(scope)
  url_options = scope.extract_options!
  options = url_options.slice!(:method)
      
  url = scope.pop
  scope = current_menu_scope(scope)
  if controller.current_menu[0, scope.size] == scope
    (options[:class] ||= "") << " active"
  end
  
  
  ("li", link_to(t(scope.last, :scope => [:navigation, scope[-2]]), url, url_options), options)
end