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 collapse

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

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

Instance Method Summary collapse

Methods included from Mixins::Common

#avatar, #badge, #card, #form, #list, #table, #unordered_list

Methods included from Mixins::Tables

#table

Methods included from Mixins::Dialogs

#dialog

Methods included from Mixins::ImageLists

#image_list

Methods included from Mixins::Icons

#icon

Methods included from Mixins::Images

#image

Methods included from Mixins::TabBars

#tab_bar

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

#blank, #body, #body2, #caption, #headline, #headline1, #headline2, #headline3, #headline4, #headline5, #headline6, #link, #overline, #page_title, #separator, #subtitle, #subtitle2, #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 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) ⇒ ExpansionPanel

Returns a new instance of ExpansionPanel.



10
11
12
13
14
15
16
# File 'lib/voom/presenters/dsl/components/expansion_panel.rb', line 10

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)
  @open = attribs.delete(:open) { false }
  expand!
end

Instance Attribute Details

#openObject

Returns the value of attribute open.



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

def open
  @open
end

Instance Method Details

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



28
29
30
31
# File 'lib/voom/presenters/dsl/components/expansion_panel.rb', line 28

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

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



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

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

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



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

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