Sha256: fd59c5157e53b4cf72c4236ca630e17af6ad6223d705bb7e66791398bb524feb

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    class BodyRowComponent < ViewComponent::Base # :nodoc:
      include Frontend::Helper

      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_options) do
          columns.each do |column|
            concat(column.to_s)
          end
        end
      end

      def cell(attribute, **options, &block)
        with_column(@table.class.body_cell_component.new(@table, @record, attribute, **options), &block)
      end

      def header?
        false
      end

      def body?
        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katalyst-tables-2.0.0 app/components/katalyst/tables/body_row_component.rb