Class: Koi::OrdinalTableComponent

Inherits:
Tables::TableComponent show all
Includes:
Katalyst::Tables::Orderable
Defined in:
app/components/koi/ordinal_table_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(collection:, id: "index-table", url: [:order, :admin, collection], scope: "order[#{collection.model_name.plural}]", **options) ⇒ OrdinalTableComponent

Returns a new instance of OrdinalTableComponent.



7
8
9
10
11
12
13
14
15
16
# File 'app/components/koi/ordinal_table_component.rb', line 7

def initialize(collection:,
               id: "index-table",
               url: [:order, :admin, collection],
               scope: "order[#{collection.model_name.plural}]",
               **options)
  super(collection:, id:, class: "index-table", caption: true, **options)

  @url   = url
  @scope = scope
end

Instance Method Details

#before_renderObject



18
19
20
# File 'app/components/koi/ordinal_table_component.rb', line 18

def before_render
  with_orderable(url: @url, scope: @scope) unless orderable?
end

#callObject



22
23
24
25
# File 'app/components/koi/ordinal_table_component.rb', line 22

def call
  concat(render_parent)
  concat(orderable)
end