Sha256: 7e888283b305bf3a5dc6d129d4f125437b13fb32f2757b24ecee81810b0ccebf

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    # View Helper for generating HTML tables. Include in your ApplicationHelper, or similar.
    module Frontend
      def table_with(collection:, component: nil, **, &)
        component ||= default_table_component_class
        render(component.new(collection:, **), &)
      end

      private

      def default_table_component_class
        component = controller.try(:default_table_component) || TableComponent
        component.respond_to?(:constantize) ? component.constantize : component
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katalyst-tables-3.0.0.beta1 app/helpers/katalyst/tables/frontend.rb
katalyst-tables-2.6.0 app/helpers/katalyst/tables/frontend.rb