Class: Voom::Presenters::DSL::Components::Table::Row

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/table.rb

Defined Under Namespace

Classes: Column

Instance Attribute Summary collapse

Attributes inherited from Base

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

Instance Method Summary collapse

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(type:, **attribs_, &block) ⇒ Row

Returns a new instance of Row.



45
46
47
48
49
50
51
# File 'lib/voom/presenters/dsl/components/table.rb', line 45

def initialize(type:, **attribs_, &block)
  super(type: type, **attribs_, &block)
  @columns = []
  @color = attribs.delete(:color)
  self.checkbox(attribs.slice(:name, :value, :checked)) if @parent.selectable
  expand!
end

Instance Attribute Details

#checkbox(**attributes, &block) ⇒ Object

Returns the value of attribute checkbox.



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

def checkbox
  @checkbox
end

#colorObject

Returns the value of attribute color.



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

def color
  @color
end

#columnsObject

Returns the value of attribute columns.



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

def columns
  @columns
end

Instance Method Details

#column(value = nil, **attribs, &block) ⇒ Object



53
54
55
56
# File 'lib/voom/presenters/dsl/components/table.rb', line 53

def column(value=nil, **attribs, &block)
  @columns << Column.new(parent: self, value: value,
                         **attribs, &block)
end