app/components/katalyst/tables/body_row_component.rb in katalyst-tables-3.0.0.beta1 vs app/components/katalyst/tables/body_row_component.rb in katalyst-tables-3.1.0

- old
+ new

@@ -2,53 +2,26 @@ module Katalyst module Tables class BodyRowComponent < ViewComponent::Base # :nodoc: include Katalyst::HtmlAttributes - include Body::TypedColumns - renders_many :columns, ->(component) { component } + renders_many :cells, ->(cell) { cell } - def initialize(table, record) - super() - - @table = table - @record = record + def before_render + content # ensure content is rendered so html_attributes can be set end - def call - content # generate content before rendering - - tag.tr(**html_attributes) do - columns.each do |column| - concat(column.to_s) - end - end - end - - def cell(attribute, **, &) - with_column(@table.body_cell_component.new(@table, @record, attribute, **), &) - end - def header? false end def body? true end - def default_html_attributes - return {} unless @table.generate_ids? - - { id: dom_id(@record) } - end - def inspect - "#<#{self.class.name} record: #{record.inspect}>" + "#<#{self.class.name}>" end - - # Backwards compatibility with tables 1.0 - alias_method :options, :html_attributes= end end end