Class: Voom::Presenters::DSL::Components::Menu::Item

Inherits:
EventBase
  • Object
show all
Includes:
BaseMenuItem, Voom::Presenters::DSL::Components::Mixins::Tooltips, Voom::Presenters::DSL::Components::Mixins::Typography
Defined in:
lib/voom/presenters/dsl/components/menu.rb

Direct Known Subclasses

Label

Instance Attribute Summary collapse

Attributes included from BaseMenuItem

#color, #position, #size

Attributes inherited from EventBase

#event_parent_id

Attributes included from Voom::Presenters::DSL::Components::Mixins::Event

#events

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods included from Voom::Presenters::DSL::Components::Mixins::Typography

#blank, #body, #body2, #caption, #headline, #headline1, #headline2, #headline3, #headline4, #headline5, #headline6, #link, #overline, #page_title, #separator, #subtitle, #subtitle2, #title

Methods included from Voom::Presenters::DSL::Components::Mixins::Append

#<<, #yield_to

Methods included from Voom::Presenters::DSL::Components::Mixins::Tooltips

#tooltip

Methods included from Voom::Presenters::DSL::Components::Mixins::Event

#event

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Voom::Presenters::DSL::Components::Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ Item

Returns a new instance of Item.



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/voom/presenters/dsl/components/menu.rb', line 81

def initialize(**attribs_, &block)
  super(type: :item, **attribs_, &block)
  @text = attribs.delete(:text)
  @disabled = attribs.delete(:disabled)
  @selected = attribs.delete(:selected) {false}
  @position = validate_position(attribs.delete(:position) { :top })
  @size = validate_size(attribs.delete(:size) { :normal })
  @color = attribs.delete(:color) { :primary }
  @components = []
  expand!
end

Instance Attribute Details

#disabledObject

Returns the value of attribute disabled.



79
80
81
# File 'lib/voom/presenters/dsl/components/menu.rb', line 79

def disabled
  @disabled
end

#selectedObject

Returns the value of attribute selected.



79
80
81
# File 'lib/voom/presenters/dsl/components/menu.rb', line 79

def selected
  @selected
end

#textObject

Returns the value of attribute text.



79
80
81
# File 'lib/voom/presenters/dsl/components/menu.rb', line 79

def text
  @text
end

Instance Method Details

#icon(icon = nil, **attribs, &block) ⇒ Object



93
94
95
96
97
# File 'lib/voom/presenters/dsl/components/menu.rb', line 93

def icon(icon=nil, **attribs, &block)
  return @icon if locked?
  @icon = Icon.new(parent: self, icon: icon,
                   **attribs, &block)
end