Sha256: 665a29e0ea7b1340e672d28e1e26094a84e402db9baccbfd25be3467a4cbd1f1

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require_relative '../item'

module CCS::Components
  module GovUK
    class Pagination < Base
      class Item < Base
        # = GOV.UK Pagination Item form
        #
        # This generates the HTML for the pagination item using a button tag
        #
        # @!attribute [r] form
        #   @return [ActionView::Helpers::FormBuilder] Form builder used to create the button

        class Form < Item
          private

          attr_reader :form

          public

          # @param (see CCS::Components::GovUK::Pagination::Item)
          # @param form [ActionView::Helpers::FormBuilder] form builder used to create the button
          #
          # @option (see CCS::Components::GovUK::Pagination::Item)

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

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

            @form = form
          end

          # Generates the HTML for the GOV.UK Pagination item button
          #
          # @return [ActiveSupport::SafeBuffer]

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ccs-frontend_helpers-0.1.0.rc.2 lib/ccs/components/govuk/pagination/item/form.rb