Class: CCS::Components::GovUK::Pagination::Item::Form

Inherits:
CCS::Components::GovUK::Pagination::Item show all
Defined in:
lib/ccs/components/govuk/pagination/item/form.rb

Overview

GOV.UK Pagination Item form

This generates the HTML for the pagination item using a button tag

Constant Summary

Constants inherited from CCS::Components::GovUK::Pagination::Item

DEFAULT_ATTRIBUTES

Constants inherited from Base

Base::DEFAULT_ATTRIBUTES

Instance Method Summary collapse

Constructor Details

#initialize(form:, **options) ⇒ Form

Returns a new instance of Form.

Parameters:

  • form (ActionView::Helpers::FormBuilder)

    form builder used to create the button



27
28
29
30
31
32
33
# File 'lib/ccs/components/govuk/pagination/item/form.rb', line 27

def initialize(form:, **options)
  super(**options)

  @options[:attributes][:class] << ' pagination-number--button_as_link'

  @form = form
end

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Pagination item button

Returns:

  • (ActiveSupport::SafeBuffer)


39
40
41
42
43
# File 'lib/ccs/components/govuk/pagination/item/form.rb', line 39

def render
  super do
    form.button(number, **@options[:attributes])
  end
end