Sha256: c3aa7fb84df50e65801a18c7bbe63b99a7823f7c600bd79f369bdc2f527e3d74

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

<%
  add_gem_component_stylesheet("devolved-nations")

  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  devolved_nations_helper = GovukPublishingComponents::Presenters::DevolvedNationsHelper.new(local_assigns)

  applies_to ||= t("components.devolved_nations.applies_to")
  heading_level ||= 2
  disable_ga4 ||= false

  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_class("gem-c-devolved-nations")

  unless disable_ga4
    component_helper.add_data_attribute({
      ga4_devolved_nations_banner: devolved_nations_helper.ga4_applicable_nations_title_text(true),
      module: "ga4-link-tracker",
      ga4_track_links_only: "",
      ga4_set_indexes: "",
      ga4_link: {
        event_name: "navigation",
        type: "devolved nations banner",
        section: t("components.devolved_nations.applies_to", locale: :en) + " " + devolved_nations_helper.ga4_applicable_nations_title_text,
      }.to_json
    })
  end
%>

<% if national_applicability.any? { |k,v| v[:applicable] == true } %>
  <%= tag.section(**component_helper.all_attributes) do %>
    <%= content_tag(shared_helper.get_heading_level, class: "govuk-heading-s govuk-!-margin-bottom-0") do %>
      <%= applies_to %> <%= devolved_nations_helper.applicable_nations_title_text %>
    <% end %>

    <% if devolved_nations_helper.nations_with_urls.any? %>
      <%= content_tag :ul, class: "govuk-list govuk-!-margin-top-1 govuk-!-margin-bottom-0" do -%>
        <% devolved_nations_helper.nations_with_urls.each do |k, v| %>
          <%= content_tag(:li, link_to(devolved_nations_helper.alternative_content_text(k), v[:alternative_url], class: "govuk-link gem-c-print-link")) %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_publishing_components-45.4.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-45.3.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb