Class: Blacklight::Response::PaginationComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/response/pagination_component.rb

Overview

Render a pagination widget for search results

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(response:, html: {}, **pagination_args) ⇒ PaginationComponent

Returns a new instance of PaginationComponent.

Parameters:

  • response (Blacklight::Response)
  • html (Hash) (defaults to: {})

    html options for the pagination container



9
10
11
12
13
# File 'app/components/blacklight/response/pagination_component.rb', line 9

def initialize(response:, html: {}, **pagination_args)
  @response = response
  @html = html
  @pagination_args = pagination_args
end

Instance Method Details

#configured_optionsObject



24
25
26
# File 'app/components/blacklight/response/pagination_component.rb', line 24

def configured_options
  controller.blacklight_config.index.pagination_options
end

#html_attrObject



15
16
17
# File 'app/components/blacklight/response/pagination_component.rb', line 15

def html_attr
  { aria: { label: t('views.pagination.aria.container_label') } }.merge(@html)
end

#paginationObject



19
20
21
22
# File 'app/components/blacklight/response/pagination_component.rb', line 19

def pagination
  args = configured_options.merge(@pagination_args).compact
  helpers.paginate @response, **args
end