Class: Voom::Presenters::DSL::Components::Card::Actions

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/card.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) ⇒ Actions

Returns a new instance of Actions.



110
111
112
113
114
115
# File 'lib/voom/presenters/dsl/components/card.rb', line 110

def initialize(**attribs_, &block)
  super(type: :action, **attribs_, &block)
  @buttons = []
  @switches = []
  expand!
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



108
109
110
# File 'lib/voom/presenters/dsl/components/card.rb', line 108

def buttons
  @buttons
end

#switchesObject

Returns the value of attribute switches.



108
109
110
# File 'lib/voom/presenters/dsl/components/card.rb', line 108

def switches
  @switches
end

Instance Method Details

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



117
118
119
120
# File 'lib/voom/presenters/dsl/components/card.rb', line 117

def button(text = nil, **options, &block)
  @buttons << Components::Button.new(parent: self, text: text,
                                     **options, &block)
end

#switch(text = nil, **options, &block) ⇒ Object



122
123
124
125
# File 'lib/voom/presenters/dsl/components/card.rb', line 122

def switch(text = nil, **options, &block)
  @switches << Components::Switch.new(parent: self, text: text,
                                      **options, &block)
end