Class: Voom::Presenters::DSL::Components::ExpansionPanel

Inherits:
EventBase
  • Object
show all
Includes:
Mixins::Common
Defined in:
lib/voom/presenters/dsl/components/expansion_panel.rb

Defined Under Namespace

Classes: Content

Instance Attribute Summary

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods included from Mixins::Common

#badge, #card, #form, #list, #table

Methods included from Mixins::Menus

#menu

Methods included from Mixins::ExpansionPanels

#expansion_panel

Methods included from Mixins::Buttons

#button

Methods included from Mixins::Grids

#grid

Methods included from Mixins::Typography

#body, #display, #headline, #subheading, #title

Methods included from Mixins::Append

#<<, #yield_to

Methods included from Mixins::Toggles

#checkbox, #icon_toggle, #radio_button, #switch

Methods included from Mixins::Event

#event

Methods inherited from Base

#expand!

Methods included from Serializer

#to_hash

Methods included from Lockable

#lock!, #locked?

Constructor Details

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

Returns a new instance of ExpansionPanel.



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

def initialize(**attribs_, &block)
  super(type: :expansion_panel, **attribs_, &block)
  self.text(attribs.delete(:text)) if attribs.key?(:text)
  self.secondary_text(attribs.delete(:secondary_text)) if attribs.key?(:secondary_text)
  expand!
end

Instance Method Details

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



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

def content(**attribs, &block)
  return @content if locked?
  @content = Content.new(parent: self, context: context, **attribs, &block)
end

#secondary_text(*text, **attribs, &block) ⇒ Object



20
21
22
23
# File 'lib/voom/presenters/dsl/components/expansion_panel.rb', line 20

def secondary_text(*text, **attribs, &block)
  return @secondary_text if locked?
  @secondary_text = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
end

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



15
16
17
18
# File 'lib/voom/presenters/dsl/components/expansion_panel.rb', line 15

def text(*text, **attribs, &block)
  return @text if locked?
  @text = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
end