Class: Voom::Presenters::DSL::Components::MultiSelect::CheckOption

Inherits:
EventBase
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/multi_select.rb

Instance Attribute Summary collapse

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::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) ⇒ CheckOption

Returns a new instance of CheckOption.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 27

def initialize(**attribs_, &block)
  super(type: :multi_select_option, **attribs_, &block)
  @value =     attribs.delete(:value)
  @text =      attribs.delete(:text)
  @selected =  attribs.delete(:selected){ true }
  @disabled =  attribs.delete(:disabled)
  self.checkbox(name: "#{attribs[:name]}[]",
                value: @value,
                text: @text,
                tag: tag,
                checked: @selected,
                disabled: @disabled,
                &block)
  expand!
end

Instance Attribute Details

#disabledObject (readonly)

Returns the value of attribute disabled.



25
26
27
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 25

def disabled
  @disabled
end

#selectedObject (readonly)

Returns the value of attribute selected.



25
26
27
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 25

def selected
  @selected
end

Instance Method Details

#checkbox(**attributes, &block) ⇒ Object



43
44
45
46
47
48
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 43

def checkbox(**attributes, &block)
  return @checkbox if locked?
  @checkbox = Components::Checkbox.new(parent: self,
                                       **attributes,
                                       &block)
end