class Docks::Themes::API::Components::Table
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Docks::Themes::API::Components::Base::new
# File lib/docks_theme_api/components/table_component.rb, line 7 def initialize(*args) @cell_element = "td" super end
Public Instance Methods
body(&block)
click to toggle source
# File lib/docks_theme_api/components/table_component.rb, line 18 def body(&block) concat "<tbody class='table__body'>#{capture(&block)}</tbody>" end
cell(content, options = {})
click to toggle source
# File lib/docks_theme_api/components/table_component.rb, line 26 def cell(content, options = {}) klass = "table__cell" klass << " table__cell--centered" if options.fetch(:centered?, false) "<#{@cell_element} class='#{klass}'>#{content}</#{@cell_element}>" end
header(&block)
click to toggle source
# File lib/docks_theme_api/components/table_component.rb, line 12 def header(&block) old_cell_element, @cell_element = @cell_element, "th" concat "<thead class='table__header'>#{capture(&block)}</thead>" @cell_element = old_cell_element end
row(&block)
click to toggle source
# File lib/docks_theme_api/components/table_component.rb, line 22 def row(&block) concat "<tr class='table__row'>#{capture(&block)}</tr>" end