Class: CCS::Components::GovUK::Pagination::Increment::Previous
- Inherits:
-
CCS::Components::GovUK::Pagination::Increment
- Object
- Base
- CCS::Components::GovUK::Pagination::Increment
- CCS::Components::GovUK::Pagination::Increment::Previous
- Defined in:
- lib/ccs/components/govuk/pagination/increment/previous.rb
Overview
GOV.UK Pagination Previous
This generates the HTML for the pagination previous link
Constant Summary collapse
- PAGINATION_ICON_PATH =
The path for the pagination previous icon
'm6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z'.freeze
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(text: nil, **options) ⇒ Previous
constructor
A new instance of Previous.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the previous link in the pagination.
Constructor Details
#initialize(text: nil, **options) ⇒ Previous
Returns a new instance of Previous.
17 18 19 |
# File 'lib/ccs/components/govuk/pagination/increment/previous.rb', line 17 def initialize(text: nil, **) super(type: :prev, text: text, default_text: 'Previous', **) end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the previous link in the pagination
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ccs/components/govuk/pagination/increment/previous.rb', line 25 def render tag.div(class: 'govuk-pagination__prev') do super do concat(pagination_icon) concat(tag.span(class: pagination_text_classes) do concat(text) concat(tag.span(' page', class: 'govuk-visually-hidden')) if text == default_text end) pagination_icon_label_text end end end |