Class: Voom::Presenters::DSL::Components::Drawer

Inherits:
Base
  • Object
show all
Includes:
Mixins::Attaches, Mixins::Common
Defined in:
lib/voom/presenters/dsl/components/drawer.rb

Instance Attribute Summary collapse

Attributes inherited from Base

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

Instance Method Summary collapse

Methods included from Namespace

#_expand_namespace_

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::Content

#content

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, #subtitle2, #text

Methods included from Mixins::Append

#<<, #yield_to

Methods included from Mixins::Toggles

#checkbox, #icon_toggle, #radio_button, #switch

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

Returns a new instance of Drawer.



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

def initialize(**attribs_, &block)
  super(type: :drawer, **attribs_, &block)
  self.title(attribs.delete(:title)) if attribs.fetch(:title){nil}
  @components = []

  expand!
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



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

def components
  @components
end

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

Returns the value of attribute subtitle.



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

def subtitle
  @subtitle
end

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

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#attach(presenter, **params, &block) ⇒ Object



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

def attach(presenter, **params, &block)
  pom = super
  @menu = pom.components.select {|i| i.type == :menu}.first
end


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

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