Class: ActivoateHelper::NavigationBuilder
- Inherits:
-
Object
- Object
- ActivoateHelper::NavigationBuilder
- Includes:
- Enumerable
- Defined in:
- app/helpers/activoate_helper.rb
Overview
Assists in the creation of navigation menus
Instance Attribute Summary collapse
-
#item_list ⇒ Object
readonly
Returns the value of attribute item_list.
Instance Method Summary collapse
- #each(&blk) ⇒ Object
-
#initialize ⇒ NavigationBuilder
constructor
A new instance of NavigationBuilder.
- #item(label, path, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ NavigationBuilder
Returns a new instance of NavigationBuilder.
277 278 279 |
# File 'app/helpers/activoate_helper.rb', line 277 def initialize @item_list = [] end |
Instance Attribute Details
#item_list ⇒ Object (readonly)
Returns the value of attribute item_list.
274 275 276 |
# File 'app/helpers/activoate_helper.rb', line 274 def item_list @item_list end |
Instance Method Details
#each(&blk) ⇒ Object
281 282 283 |
# File 'app/helpers/activoate_helper.rb', line 281 def each(&blk) item_list.each(&blk) end |
#item(label, path, options = {}) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'app/helpers/activoate_helper.rb', line 285 def item(label, path, = {}) [:class] ||= "" [:class] << " first" if item_list.empty? [:class] << " active" if [:active] [:link_options] ||= {} [:link_options].merge!(:method => [:method]) if [:method] item_list << { :label => label, :href => path, :class => [:class].strip, :link_options => [:link_options], :icon => [:icon], :active => !![:active] } end |