Sha256: 3d3051653a7cedbf4b39b6ffea6dba4feb1adadf3c2be3a1db828988c56b9d7a

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

module GovukPublishingComponents
  module Presenters
    class PublicLayoutHelper
      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] || I18n.t("components.layout_footer.navigation_links").each_with_index.map do |menu, i|
          {
            title: menu[:title],
            columns: FOOTER_NAVIGATION_COLUMNS[i],
            items: menu[:menu_contents].map do |item|
              item.merge({
                attributes: {
                  data: {
                    track_category: "footerClicked",
                    track_action: "footerLinks",
                    track_label: item[:text],
                  },
                },
              })
            end,
          }
        end
        @footer_meta = local_assigns[:footer_meta] || FOOTER_META
        @cookie_banner_data = local_assigns[:cookie_banner_data] || {}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-29.9.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-29.8.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-29.7.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb
govuk_publishing_components-29.6.0 lib/govuk_publishing_components/presenters/public_layout_helper.rb