Class: RubyCms::Admin::BulkActionTable::BulkActionTablePagination

Inherits:
RubyCms::Admin::BaseComponent show all
Defined in:
app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_pagination.rb

Overview

Pagination component Renders pagination controls with Previous/Next and page numbers

Instance Method Summary collapse

Methods inherited from RubyCms::Admin::BaseComponent

#build_classes, #conditional_attributes, #controller, #form_authenticity_token, #helpers, #merge_data_attributes, #token_from_controller, #token_from_controller?, #token_from_helpers?

Constructor Details

#initialize(pagination:, pagination_path:, turbo_frame: nil) ⇒ BulkActionTablePagination

Returns a new instance of BulkActionTablePagination.



13
14
15
16
17
18
19
20
21
22
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_pagination.rb', line 13

def initialize(
  pagination:,
  pagination_path:,
  turbo_frame: nil
)
  super
  @pagination = pagination || {}
  @pagination_path = pagination_path
  @turbo_frame = turbo_frame
end

Instance Method Details

#view_templateObject



24
25
26
27
28
29
30
31
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_pagination.rb', line 24

def view_template
  return unless @pagination[:total_pages] && @pagination[:total_pages] > 1

  div(class: "px-5 py-3 flex items-center justify-between gap-4 bg-muted/30") do
    render_pagination_info
    render_pagination_controls
  end
end