Sha256: f5c19f802c2be7a4577bb70c81fa66771d29445bce160acedc551251638b751a

Contents?: true

Size: 1.99 KB

Versions: 70

Compression:

Stored size: 1.99 KB

Contents

module GovukPublishingComponents
  module Presenters
    class PublicLayoutHelper
      BLUE_BAR_BACKGROUND_COLOURS = %w[browse].freeze
      FOOTER_NAVIGATION_COLUMNS = [2, 1].freeze
      FOOTER_META = {
        items: [
          {
            href: "/help",
            text: "Help",
          },
          {
            href: "/help/privacy-notice",
            text: "Privacy",
          },
          {
            href: "/help/cookies",
            text: "Cookies",
          },
          {
            href: "/help/accessibility-statement",
            text: "Accessibility statement",
          },
          {
            href: "/contact",
            text: "Contact",
          },
          {
            href: "/help/terms-conditions",
            text: "Terms and conditions",
          },
          {
            href: "/cymraeg",
            text: "Rhestr o Wasanaethau Cymraeg",
            attributes: {
              lang: "cy",
            },
          },
          {
            href: "/government/organisations/government-digital-service",
            text: "Government Digital Service",
          },
        ],
      }.freeze

      attr_reader :footer_navigation, :footer_meta, :cookie_banner_data

      def initialize(local_assigns)
        @footer_navigation = local_assigns[:footer_navigation] || navigation_link_generation_from_locale(I18n.t("components.layout_footer.navigation_links"))
        @footer_meta = local_assigns[:footer_meta] || { items: FOOTER_META[:items] }
        @cookie_banner_data = local_assigns[:cookie_banner_data] || {}
      end

      def navigation_link_generation_from_locale(links)
        links.each_with_index.map do |menu, i|
          {
            title: menu[:title],
            columns: footer_navigation_columns[i],
            items: menu[:menu_contents],
          }
        end
      end

      def footer_navigation_columns
        FOOTER_NAVIGATION_COLUMNS
      end

      def blue_bar_background_colours
        BLUE_BAR_BACKGROUND_COLOURS
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
govuk_publishing_components-55.1.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-55.0.1 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-55.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-54.0.1 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-54.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-53.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-52.1.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-52.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-51.2.1 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-51.2.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-51.1.1 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-51.1.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-51.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-50.0.1 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-50.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-49.1.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-49.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-48.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-47.0.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-46.4.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb