Sha256: 0e42b5fc0b97a9ac8b3213b3baafd45334aaa9d474a4ede0ffb51e249fc7ed56

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

module Koi
  module Tables
    # Custom body row component, in order to override the default body cell component
    class BodyRowComponent < Katalyst::Tables::BodyRowComponent
      def boolean(attribute, **options, &block)
        with_column(Body::BooleanComponent.new(@table, @record, attribute, **options), &block)
      end

      def date(attribute, format: :admin, **options, &block)
        with_column(Body::DateComponent.new(@table, @record, attribute, format:, **options), &block)
      end

      def datetime(attribute, format: :admin, **options, &block)
        with_column(Body::DatetimeComponent.new(@table, @record, attribute, format:, **options), &block)
      end

      def number(attribute, **options, &block)
        with_column(Body::NumberComponent.new(@table, @record, attribute, **options), &block)
      end

      def money(attribute, **options, &block)
        with_column(Body::MoneyComponent.new(@table, @record, attribute, **options), &block)
      end

      def rich_text(attribute, **options, &block)
        with_column(Body::RichTextComponent.new(@table, @record, attribute, **options), &block)
      end

      def link(attribute, **options, &block)
        with_column(Body::LinkComponent.new(@table, @record, attribute, **options), &block)
      end

      def text(attribute, **options, &block)
        with_column(BodyCellComponent.new(@table, @record, attribute, **options), &block)
      end

      def image(attribute, variant: :thumb, **options, &block)
        with_column(Body::ImageComponent.new(@table, @record, attribute, variant:, **options), &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katalyst-koi-4.5.0.beta.2 app/components/koi/tables/body_row_component.rb
katalyst-koi-4.5.0.beta.1 app/components/koi/tables/body_row_component.rb