Sha256: 373466155e98fd17f4e9c0230f588a1469e910b85aa155e72b85f0af4c260718

Contents?: true

Size: 615 Bytes

Versions: 5

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

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

    renders_one :table, Katalyst::Turbo::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

5 entries across 5 versions & 1 rubygems

Version Path
katalyst-koi-4.4.1 app/components/koi/index_table_component.rb
katalyst-koi-4.4.0 app/components/koi/index_table_component.rb
katalyst-koi-4.3.5 app/components/koi/index_table_component.rb
katalyst-koi-4.3.4 app/components/koi/index_table_component.rb
katalyst-koi-4.3.3 app/components/koi/index_table_component.rb