Sha256: 80ee5ff9403738699abbb7a8c8c16f55bf04e0fe6870b852fceedcd988bf7b52
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Katalyst module Tables class BodyRowComponent < ViewComponent::Base # :nodoc: include Katalyst::HtmlAttributes include Body::TypedColumns renders_many :columns, ->(component) { component } def initialize(table, record) super() @table = table @record = record 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}>" end # Backwards compatibility with tables 1.0 alias_method :options, :html_attributes= end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katalyst-tables-3.0.0.beta1 | app/components/katalyst/tables/body_row_component.rb |