Class: Voom::Presenters::DSL::Components::Lists::Action

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/lists/action.rb

Instance Attribute Summary collapse

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

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

Returns a new instance of Action.



9
10
11
12
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 9

def initialize(**attribs_, &block)
  super(type: :action, **attribs_, &block)
  expand!
end

Instance Attribute Details

#action_typeObject

Returns the value of attribute action_type.



7
8
9
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 7

def action_type
  @action_type
end

Instance Method Details

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



58
59
60
61
62
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 58

def button(text = nil, **attribs, &block)
  return @button if locked?
  @action_type = :button
  @button = Components::Button.new(text: text, parent: self, **attribs, &block)
end

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



29
30
31
32
33
34
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 29

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

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



14
15
16
17
18
19
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 14

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

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



50
51
52
53
54
55
56
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 50

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


22
23
24
25
26
27
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 22

def menu(**attribs, &block)
  return @menu if locked?
  @action_type = :menu
  @menu = Menu.new(parent: self,
                   **attribs, &block)
end

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



36
37
38
39
40
41
# File 'lib/voom/presenters/dsl/components/lists/action.rb', line 36

def radio_button(**attribs, &block)
  return @radio_button if locked?
  @action_type = :radio_button
  @radio_button = RadioButton.new(parent: self,
                                  **attribs, &block)
end

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



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

def switch(**attribs, &block)
  return @switch if locked?
  @action_type = :switch
  @switch = Switch.new(parent: self,
                       **attribs, &block)
end