Class: Golden::Menu::OptionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/golden/menu/option_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ OptionHelper



8
9
10
11
12
13
# File 'lib/golden/menu/option_helper.rb', line 8

def initialize args
  @menu_type = args.delete(:menu_type) || []
  @linked = args.delete(:menu_linked)
  @linked = false if @linked.nil?
  @options = args
end

Instance Attribute Details

#linkedObject

Returns the value of attribute linked.



5
6
7
# File 'lib/golden/menu/option_helper.rb', line 5

def linked
  @linked
end

Returns the value of attribute menu_type.



4
5
6
# File 'lib/golden/menu/option_helper.rb', line 4

def menu_type
  @menu_type
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/golden/menu/option_helper.rb', line 6

def options
  @options
end

Instance Method Details

#linked?Boolean



35
36
37
# File 'lib/golden/menu/option_helper.rb', line 35

def linked?
  linked
end


19
20
21
22
23
24
25
# File 'lib/golden/menu/option_helper.rb', line 19

def menu_li_class
  if menu_type.include? 'dropup'
    { class: 'dropup' }
  else
    { class: 'dropdown' }
  end
end


15
16
17
# File 'lib/golden/menu/option_helper.rb', line 15

def menu_ul_class
  { class: 'nav' }.deep_merge options
end


27
28
29
30
31
32
33
# File 'lib/golden/menu/option_helper.rb', line 27

def submenu_li_class
  if menu_type.include? 'pull-left'
    { class: 'dropdown-submenu pull-left' }
  else
    { class: 'dropdown-submenu' }
  end
end