Class: RubyUIAdmin::UI::Pagination

Inherits:
Base
  • Object
show all
Defined in:
app/components/ruby_ui_admin/ui/pagination.rb

Overview

Orchestrates RubyUI's Pagination primitives (PaginationContent / PaginationItem / PaginationEllipsis) from a Pagy instance: numbered page links with gaps, plus Previous/Next. In countless mode (no total) it shows Previous/Next only.

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(pagy:, url_for_page:, countless: false, **attrs) ⇒ Pagination

Returns a new instance of Pagination.



9
10
11
12
13
14
# File 'app/components/ruby_ui_admin/ui/pagination.rb', line 9

def initialize(pagy:, url_for_page:, countless: false, **attrs)
  @pagy = pagy
  @url_for_page = url_for_page
  @countless = countless
  super(**attrs)
end

Instance Method Details

#view_templateObject



16
17
18
19
20
21
22
23
24
# File 'app/components/ruby_ui_admin/ui/pagination.rb', line 16

def view_template
  nav(**attrs) do
    render PaginationContent.new do
      render_edge(:prev)
      render_series unless @countless
      render_edge(:next)
    end
  end
end