Sha256: b099b56b7a645855ef05936b8b9773dafe2ab5a3fd2c68ec646711e9388a170d

Contents?: true

Size: 702 Bytes

Versions: 13

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Koi
  class IndexTableComponent < ViewComponent::Base
    attr_reader :id, :pagy_id

    # Use the Koi::Tables::TableComponent to support custom header and body row components
    renders_one :table, Koi::Tables::TableComponent
    renders_one :pagination, Katalyst::Turbo::PagyNavComponent

    def initialize(collection:, id: "index-table", **options)
      super

      @id      = id
      @pagy_id = "#{id}-pagination"

      with_table(collection:, id:, class: "index-table", caption: true, **options)
      with_pagination(collection:, id: pagy_id) if collection.paginate?
    end

    def call
      concat(table)
      concat(pagination)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
katalyst-koi-4.6.0 app/components/koi/index_table_component.rb
katalyst-koi-4.5.9 app/components/koi/index_table_component.rb
katalyst-koi-4.5.8 app/components/koi/index_table_component.rb
katalyst-koi-4.5.7 app/components/koi/index_table_component.rb
katalyst-koi-4.5.6 app/components/koi/index_table_component.rb
katalyst-koi-4.5.5 app/components/koi/index_table_component.rb
katalyst-koi-4.5.4 app/components/koi/index_table_component.rb
katalyst-koi-4.5.3 app/components/koi/index_table_component.rb
katalyst-koi-4.5.2 app/components/koi/index_table_component.rb
katalyst-koi-4.5.1 app/components/koi/index_table_component.rb
katalyst-koi-4.5.0 app/components/koi/index_table_component.rb
katalyst-koi-4.5.0.beta.2 app/components/koi/index_table_component.rb
katalyst-koi-4.5.0.beta.1 app/components/koi/index_table_component.rb