Class: SolidWebUi::Ui::PaginatorComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/solid_web_ui/ui/paginator_component.rb

Overview

Renders pagination controls for a SolidWebUi::Paginator. ‘page_url` is a callable mapping a page number to a URL (so the component stays decoupled from any engine’s routes). Hidden entirely when there is only one page.

Instance Method Summary collapse

Constructor Details

#initialize(paginator:, page_url:) ⇒ PaginatorComponent

Returns a new instance of PaginatorComponent.



9
10
11
12
# File 'app/components/solid_web_ui/ui/paginator_component.rb', line 9

def initialize(paginator:, page_url:)
  @paginator = paginator
  @page_url = page_url
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/solid_web_ui/ui/paginator_component.rb', line 14

def render?
  @paginator.total_pages > 1
end