Class: GovukPublishingComponents::Presenters::PublicLayoutHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_publishing_components/presenters/public_layout_helper.rb

Constant Summary collapse

BLUE_BAR_BACKGROUND_COLOURS =
%w[browse].freeze
[2, 1].freeze
{
  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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_assigns) ⇒ PublicLayoutHelper

Returns a new instance of PublicLayoutHelper.



48
49
50
51
52
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 48

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

Instance Attribute Details

Returns the value of attribute cookie_banner_data.



46
47
48
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 46

def cookie_banner_data
  @cookie_banner_data
end

Returns the value of attribute footer_meta.



46
47
48
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 46

def footer_meta
  @footer_meta
end

Returns the value of attribute footer_navigation.



46
47
48
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 46

def footer_navigation
  @footer_navigation
end

Instance Method Details

#blue_bar_background_coloursObject



68
69
70
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 68

def blue_bar_background_colours
  BLUE_BAR_BACKGROUND_COLOURS
end


64
65
66
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 64

def footer_navigation_columns
  FOOTER_NAVIGATION_COLUMNS
end


54
55
56
57
58
59
60
61
62
# File 'lib/govuk_publishing_components/presenters/public_layout_helper.rb', line 54

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