Class: Voom::Presenters::DSL::Components::Dialog

Inherits:
EventBase
  • Object
show all
Includes:
Mixins::Attaches, Mixins::Common, Mixins::Event, Mixins::Progress, Mixins::Sliders, Mixins::Steppers
Defined in:
lib/voom/presenters/dsl/components/dialog.rb

Defined Under Namespace

Classes: Actions

Instance Attribute Summary collapse

Attributes included from Mixins::Event

#events

Attributes inherited from EventBase

#event_parent_id

Attributes inherited from Base

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

Instance Method Summary collapse

Methods included from Mixins::Progress

#progress

Methods included from Mixins::Event

#event

Methods included from Mixins::Sliders

#slider

Methods included from Mixins::Steppers

#stepper

Methods included from Mixins::Attaches

#attach

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

#menu

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

Returns a new instance of Dialog.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 21

def initialize(**attribs_, &block)
  super(type: :dialog, **attribs_, &block)
  width = attribs.delete(:width)
  height = attribs.delete(:height)
  @percent_width = width&.end_with?("%") ? width : nil
  @percent_height = height&.end_with?("%") ? height : nil
  @px_width = !width&.end_with?("%") ? width : nil
  @px_height = !height&.end_with?("%") ? height : nil
  @shows_errors = attribs.delete(:shows_errors){true}

  @buttons = []
  @components=[]
  expand!
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def buttons
  @buttons
end

#componentsObject

Returns the value of attribute components.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def components
  @components
end

#percent_heightObject

Returns the value of attribute percent_height.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def percent_height
  @percent_height
end

#percent_widthObject

Returns the value of attribute percent_width.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def percent_width
  @percent_width
end

#px_heightObject

Returns the value of attribute px_height.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def px_height
  @px_height
end

#px_widthObject

Returns the value of attribute px_width.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def px_width
  @px_width
end

#shows_errorsObject

Returns the value of attribute shows_errors.



13
14
15
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 13

def shows_errors
  @shows_errors
end

Instance Method Details

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



55
56
57
58
59
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 55

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

#body(*text, **options, &block) ⇒ Object



49
50
51
52
53
# File 'lib/voom/presenters/dsl/components/dialog.rb', line 49

def body(*text, **options, &block)
  components << Components::Typography.new(parent: self, type: :body,
                                           text: text,
                                           **options, &block)
end

#heading(*text, **options, &block) ⇒ Object



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

def heading(*text, **options, &block)
  components << Components::Typography.new(parent: self, type: :heading,
                                           text: text,
                                        **options, &block)
end

#title(*title, **options, &block) ⇒ Object



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

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