Method: Satis::Menus::Item#initialize
- Defined in:
- lib/satis/menus/item.rb
#initialize(id, link: nil, label: nil, icon: nil, link_attributes: {}, active: nil, scope: [], level: nil, type: :item, &block) ⇒ Item
Returns a new instance of Item.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/satis/menus/item.rb', line 10 def initialize(id, link: nil, label: nil, icon: nil, link_attributes: {}, active: nil, scope: [], level: nil, type: :item, &block) @id = id @label = label @icon = icon @link = link @link_attributes = link_attributes @scope = scope @level = level @type = type @link_attributes = @link_attributes.merge(data: { action: 'click->satis-menu#toggle' }) if type == :toggle @menu = Menu.new(scope + ["#{id}_menu".to_sym], level: level + 1, &block) if block_given? end |