Sha256: 67151c83e24d9be088b855a44400711fa2e11bbec890ad8163d26ee3fcc8ace6

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-0.3.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.2.0 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.2 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.1 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.1.rc.1 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.0.rc.7 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.0.rc.6 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.0.rc.5 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.0.rc.4 lib/ccs/components/govuk/pagination/item/form.rb
ccs-frontend_helpers-0.1.0.rc.3 lib/ccs/components/govuk/pagination/item/form.rb