Class: UI::Table

Inherits:
Phlex::HTML
  • Object
show all
Includes:
TableBehavior
Defined in:
app/components/ui/table.rb

Instance Method Summary collapse

Methods included from TableBehavior

#render_table, #table_classes, #table_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ Table

Returns a new instance of Table.



6
7
8
9
# File 'app/components/ui/table.rb', line 6

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#body(classes: "", **attributes, &block) ⇒ Object



22
23
24
# File 'app/components/ui/table.rb', line 22

def body(classes: "", **attributes, &block)
  render UI::TableBody.new(classes: classes, **attributes, &block)
end

#caption(classes: "", **attributes, &block) ⇒ Object



30
31
32
# File 'app/components/ui/table.rb', line 30

def caption(classes: "", **attributes, &block)
  render UI::TableCaption.new(classes: classes, **attributes, &block)
end

#cell(classes: "", **attributes, &block) ⇒ Object



42
43
44
# File 'app/components/ui/table.rb', line 42

def cell(classes: "", **attributes, &block)
  render UI::TableCell.new(classes: classes, **attributes, &block)
end


26
27
28
# File 'app/components/ui/table.rb', line 26

def footer(classes: "", **attributes, &block)
  render UI::TableFooter.new(classes: classes, **attributes, &block)
end

#head(classes: "", **attributes, &block) ⇒ Object



38
39
40
# File 'app/components/ui/table.rb', line 38

def head(classes: "", **attributes, &block)
  render UI::TableHead.new(classes: classes, **attributes, &block)
end

#header(classes: "", **attributes, &block) ⇒ Object

DSL methods



18
19
20
# File 'app/components/ui/table.rb', line 18

def header(classes: "", **attributes, &block)
  render UI::TableHeader.new(classes: classes, **attributes, &block)
end

#row(classes: "", **attributes, &block) ⇒ Object



34
35
36
# File 'app/components/ui/table.rb', line 34

def row(classes: "", **attributes, &block)
  render UI::TableRow.new(classes: classes, **attributes, &block)
end

#view_template(&block) ⇒ Object



11
12
13
14
15
# File 'app/components/ui/table.rb', line 11

def view_template(&block)
  table(**table_html_attributes.deep_merge(@attributes)) do
    yield(self) if block_given?
  end
end