Class: Voom::Presenters::DSL::Components::Grid

Inherits:
EventBase show all
Includes:
Mixins::Attaches, Mixins::Dialogs, Mixins::Padding, Mixins::Progress, Mixins::Snackbars
Defined in:
lib/voom/presenters/dsl/components/grid.rb

Defined Under Namespace

Classes: Column

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

#coerce_padding, #validate_padding

Methods included from Mixins::Progress

#progress

Methods included from Mixins::Snackbars

#snackbar

Methods included from Mixins::Dialogs

#dialog

Methods included from Mixins::Attaches

#attach

Methods included from Namespace

#_expand_namespace_

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(color: nil, **attribs_, &block) ⇒ Grid

Returns a new instance of Grid.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/voom/presenters/dsl/components/grid.rb', line 19

def initialize(color: nil, **attribs_, &block)
  super(type: :grid, **attribs_, &block)
  @columns = []
  @color = color
  padding = attribs.delete(:padding) {nil}
  @padding = validate_padding(coerce_padding(padding, default_level: 3)).uniq if padding != nil
  @wide = attribs.delete(:wide) {false}
  @gutter = coerce_gutter(attribs.delete(:gutter) {nil})
  @height = attribs.delete(:height) {nil}
  expand!
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def color
  @color
end

#columnsObject (readonly)

Returns the value of attribute columns.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def columns
  @columns
end

#gutterObject (readonly)

Returns the value of attribute gutter.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def gutter
  @gutter
end

#heightObject (readonly)

Returns the value of attribute height.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def height
  @height
end

#paddingObject (readonly)

Returns the value of attribute padding.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def padding
  @padding
end

#wideObject (readonly)

Returns the value of attribute wide.



12
13
14
# File 'lib/voom/presenters/dsl/components/grid.rb', line 12

def wide
  @wide
end

Instance Method Details

#column(size, color: nil, **attribs, &block) ⇒ Object



31
32
33
34
35
# File 'lib/voom/presenters/dsl/components/grid.rb', line 31

def column(size, color: nil, **attribs, &block)
  attribs = size.respond_to?(:keys) ? attribs.merge(size) : attribs.merge(size: size)
  @columns << Column.new(parent: self, color: color,
                         **attribs, &block)
end