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

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

Defined Under Namespace

Classes: Pagination, Row

Instance Attribute Summary collapse

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

#event

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

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

Returns a new instance of Table.



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

def initialize(**attribs_, &block)
  super(type: :table, **attribs_, &block)
  @selectable = attribs.delete(:selectable)
  @border = attribs.delete(:border){ true }
  @width = attribs.delete(:width)
  @rows = []
  expand!
end

Instance Attribute Details

#borderObject

Returns the value of attribute border.



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

def border
  @border
end

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

Returns the value of attribute header.



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

def header
  @header
end

#rowsObject

Returns the value of attribute rows.



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

def rows
  @rows
end

#selectableObject

Returns the value of attribute selectable.



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

def selectable
  @selectable
end

#widthObject

Returns the value of attribute width.



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

def width
  @width
end

Instance Method Details



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

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

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



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

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

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



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

def row(**attribs, &block)
  @rows << Row.new(parent: self, type: :row,
                   **attribs, &block)
end