Class: Spark::NavMenuHelper::SidebarNav
- Inherits:
-
TreeNav
- Object
- SparkEngine::BlockHelper
- Helper
- MenuHelper::Menu
- TreeNav
- Spark::NavMenuHelper::SidebarNav
- Defined in:
- app/helpers/spark/nav_menu_helper.rb
Constant Summary
Constants inherited from MenuHelper::Menu
Instance Method Summary collapse
-
#initialize(title, options = {}) ⇒ SidebarNav
constructor
A new instance of SidebarNav.
- #item(content, url, options = {}, &block) ⇒ Object
- #item_tree(name, options = {}, &block) ⇒ Object
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, = {} ) @tree = 'sidebar_nav' ['data-tree'] = @tree super( title, ) 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, ={}, &block ) = .stringify_keys new = is_new?( .delete( 'new' ) ) beta = is_beta?( .delete( 'beta' ) ) active = is_active?( .delete( 'active' ) ) classes = [] classes.push( 'item-beta' ) if beta classes.push( 'item-new' ) if new classes.push( 'item-active' ) if active = add_class( , classes ) super( content, url, , &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, ={}, &block ) = .stringify_keys content = capture( &block ) classes = [] classes.push( 'tree-new' ) if is_new?( .delete( 'new' ) ) || content.match(/item-new/) classes.push( 'tree-beta' ) if is_beta?( .delete( 'beta' ) ) || content.match(/item-beta/) = add_class( , classes ) super( name, , &block ) end |