Sha256: 76d0daaecdaa66e2a641ffccd8fe56b504ebadecacb680cd433e5fb677d85452

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

require_relative '../item'

module CCS
  module 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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-2.0.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.2.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.1.2 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.1.1 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.1.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-1.0.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/components/govuk/pagination/item/form.rb