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

Inherits:
Select show all
Defined in:
lib/voom/presenters/dsl/components/multi_select.rb

Defined Under Namespace

Classes: CheckOption

Instance Attribute Summary

Attributes inherited from Select

#full_width, #options, #outlined, #required

Attributes inherited from Input

#dirtyable, #disabled, #name

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 inherited from Select

#hint, #icon, #label, #option, #value

Methods inherited from Input

#validation_error

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) ⇒ MultiSelect

Returns a new instance of MultiSelect.



7
8
9
10
11
12
13
14
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 7

def initialize(**attribs_, &block)
  super(type: :multi_select, **attribs_, &block)
  @required = attribs.delete(:required)
  @full_width = attribs.delete(:full_width){ true }
  @outlined = attribs.delete(:outlined){ true }
  @options = []
  expand!
end

Instance Method Details

#check_option(**attribs, &block) ⇒ Object



16
17
18
19
20
21
# File 'lib/voom/presenters/dsl/components/multi_select.rb', line 16

def check_option(**attribs, &block)
  @options << CheckOption.new(parent: self,
                          name: @name,
                          tag: @tag,
                          **attribs.delete_if{ |k,v| [:tag, :name].include?(k) }, &block)
end