Class: CCS::Components::GovUK::Pagination::Increment
- Defined in:
- lib/ccs/components/govuk/pagination/increment.rb,
lib/ccs/components/govuk/pagination/increment/next.rb,
lib/ccs/components/govuk/pagination/increment/previous.rb
Overview
Defined Under Namespace
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(type:, default_text:, block_is_level:, text: nil, label_text: nil, **options) ⇒ Increment
constructor
A new instance of Increment.
-
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the pagination increment link/button.
Constructor Details
#initialize(type:, default_text:, block_is_level:, text: nil, label_text: nil, **options) ⇒ Increment
Returns a new instance of Increment.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ccs/components/govuk/pagination/increment.rb', line 43 def initialize(type:, default_text:, block_is_level:, text: nil, label_text: nil, **) super(**) @options[:attributes][:class] = "govuk-link govuk-pagination__link #{'pagination--button_as_link' if @options[:form]}".rstrip @options[:attributes][:rel] = type.to_s @type = type @default_text = default_text @text = text || default_text @block_is_level = block_is_level @label_text = label_text end |
Instance Method Details
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the pagination increment link/button
64 65 66 67 68 69 70 |
# File 'lib/ccs/components/govuk/pagination/increment.rb', line 64 def render(&) if [:form] [:form].(**[:attributes], &) else link_to([:href], **[:attributes], &) end end |