Class: Spark::NavMenuHelper::SidebarNav

Inherits:
TreeNav show all
Defined in:
app/helpers/spark/nav_menu_helper.rb

Constant Summary

Constants inherited from MenuHelper::Menu

MenuHelper::Menu::DEFAULTS

Instance Method Summary collapse

Methods inherited from MenuHelper::Menu

#display, #group, #header, #link

Constructor Details

#initialize(title, options = {}) ⇒ SidebarNav

Returns a new instance of SidebarNav.



92
93
94
95
96
# File 'app/helpers/spark/nav_menu_helper.rb', line 92

def initialize( title, options = {} )
  @tree = 'sidebar_nav'
  options['data-tree'] = @tree
  super( title, options )
end

Instance Method Details

#item(content, url, options = {}, &block) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'app/helpers/spark/nav_menu_helper.rb', line 98

def item( content, url, options={}, &block )
  options = options.stringify_keys
  new = is_new?( options.delete( 'new' ) )
  beta = is_beta?( options.delete( 'beta' ) )
  active = is_active?( options.delete( 'active' ) )

  classes = []
  classes.push( 'item-beta' )   if beta
  classes.push( 'item-new' )    if new
  classes.push( 'item-active' ) if active
  options = add_class( options, classes )


  super( content, url, options, &block)
end

#item_tree(name, options = {}, &block) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
# File 'app/helpers/spark/nav_menu_helper.rb', line 115

def item_tree( name, options={}, &block )
  options = options.stringify_keys
  content = capture( &block )

  classes = []
  classes.push( 'tree-new' )    if is_new?( options.delete( 'new' ) ) || content.match(/item-new/)
  classes.push( 'tree-beta' )   if is_beta?( options.delete( 'beta' ) ) || content.match(/item-beta/)

  options = add_class( options, classes )

  super( name, options, &block )
end