Sha256: 0d8904e5c9383f366620b2cb82560811e1080c734e91c5fc2de1a77bc5ab4c43

Contents?: true

Size: 1.49 KB

Versions: 20

Compression:

Stored size: 1.49 KB

Contents

require 'action_view'

require_relative 'list/item'

module CCS
  module Components
    module GovUK
      class StepByStepNavigation < Base
        class Section < Base
          class Content
            # = GOV.UK Step by step navigation section content list
            #
            # Generates the list HTML for the step by step navigation section content
            #
            # @!attribute [r] items
            #   @return [Item] Array of initialised list items

            class List
              include ActionView::Context
              include ActionView::Helpers

              private

              attr_reader :items

              public

              # @param items [Array<Hash>] An array of options for the list items
              #                            See {Components::GovUK::StepByStepNavigation::Section::Content::List::Item#initialize Item#initialize} for details of the items in the array.

              def initialize(items:)
                @items = items.map { |item| Item.new(**item) }
              end

              # Generates the HTML for the GOV.UK Step by step navigation section content list
              #
              # @return [ActiveSupport::SafeBuffer]

              def render
                tag.ul(class: 'gem-c-step-nav__list gem-c-step-nav__list--choice', data: { length: items.length.to_s }) do
                  items.each { |item| concat(item.render) }
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-2.0.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.2.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.1.2 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.1.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.1.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-1.0.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.3.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.2.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.2 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.1.rc.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.0.rc.7 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.0.rc.6 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.0.rc.5 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.0.rc.4 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb
ccs-frontend_helpers-0.1.0.rc.3 lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb