Class: Railsboot::PaginationComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::PaginationComponent
- Defined in:
- app/components/railsboot/pagination_component.rb
Overview
ViewComponent: renders the pagination block.
Instance Method Summary collapse
-
#initialize(pagy:) ⇒ PaginationComponent
constructor
A new instance of PaginationComponent.
-
#render? ⇒ Boolean
Whether the component should render at all, only when there is more than one page of results.
Constructor Details
#initialize(pagy:) ⇒ PaginationComponent
Returns a new instance of PaginationComponent.
5 6 7 |
# File 'app/components/railsboot/pagination_component.rb', line 5 def initialize(pagy:) @pagy = pagy end |
Instance Method Details
#render? ⇒ Boolean
Whether the component should render at all, only when there is more
than one page of results.
12 13 14 |
# File 'app/components/railsboot/pagination_component.rb', line 12 def render? @pagy.present? && @pagy.last.to_i > 1 end |