Class: Anchor::TableComponent

Inherits:
Component
  • Object
show all
Includes:
Pagination
Defined in:
app/components/anchor/table_component.rb

Defined Under Namespace

Classes: ColumnComponent

Constant Summary

Constants included from Pagination

Pagination::INITIAL_PAGE, Pagination::PER_PAGE_DEFAULT, Pagination::QUERY_PARAM

Constants included from ViewHelper

ViewHelper::ANCHOR_HELPERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Pagination

#page, #paginated_data, #per_page, #position

Methods inherited from Component

generate_id

Methods included from ViewHelper

#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(data:, caption: nil, empty_message: nil, row_classes: nil, rows_link_to: nil, sort_url: nil, sortable: false, paginate: false, **kwargs) ⇒ TableComponent

Returns a new instance of TableComponent.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/components/anchor/table_component.rb', line 16

def initialize(
  data:,
  caption: nil,
  empty_message: nil,
  row_classes: nil,
  rows_link_to: nil,
  sort_url: nil,
  sortable: false,
  paginate: false,
  **kwargs
)
  @data = data
  @empty_message = empty_message
  @rows_link_to = rows_link_to
  @row_classes = row_classes
  @sortable = sortable
  @sort_url = sort_url
  @caption = caption
  @paginate = paginate

  super(**kwargs)
end

Instance Attribute Details

#captionObject (readonly)

Returns the value of attribute caption.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def caption
  @caption
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def data
  @data
end

#paginateObject (readonly)

Returns the value of attribute paginate.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def paginate
  @paginate
end

#row_classesObject (readonly)

Returns the value of attribute row_classes.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def row_classes
  @row_classes
end

Returns the value of attribute rows_link_to.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def rows_link_to
  @rows_link_to
end

#sortableObject (readonly)

Returns the value of attribute sortable.



7
8
9
# File 'app/components/anchor/table_component.rb', line 7

def sortable
  @sortable
end