Class: RubyUI::DataTablePagination
- Defined in:
- lib/ruby_ui/data_table/data_table_pagination.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(with: nil, pagy: nil, kaminari: nil, page: nil, per_page: nil, total_count: nil, page_param: "page", path: "", query: {}, window: 1, prev_label: "<", next_label: ">", **attrs) ⇒ DataTablePagination
constructor
A new instance of DataTablePagination.
- #view_template ⇒ Object
Constructor Details
#initialize(with: nil, pagy: nil, kaminari: nil, page: nil, per_page: nil, total_count: nil, page_param: "page", path: "", query: {}, window: 1, prev_label: "<", next_label: ">", **attrs) ⇒ DataTablePagination
Returns a new instance of DataTablePagination.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_ui/data_table/data_table_pagination.rb', line 10 def initialize(with: nil, pagy: nil, kaminari: nil, page: nil, per_page: nil, total_count: nil, page_param: "page", path: "", query: {}, window: 1, prev_label: "<", next_label: ">", **attrs) @adapter = resolve_adapter(with:, pagy:, kaminari:, page:, per_page:, total_count:) @page_param = page_param @path = path @query = query.to_h.transform_keys(&:to_s) @window = window @prev_label = prev_label @next_label = next_label super(**attrs) end |
Instance Method Details
#view_template ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruby_ui/data_table/data_table_pagination.rb', line 21 def view_template return if total <= 1 render RubyUI::Pagination.new(class: "mx-0 w-auto justify-end", **attrs) do render RubyUI::PaginationContent.new do prev_item number_items next_item end end end |