Sha256: dae0200539f1bfb6ca72310e8ebe6cc9d44099e2e3d1e71263c261d7c2593e16

Contents?: true

Size: 1.8 KB

Versions: 33

Compression:

Stored size: 1.8 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-force-print-link-styles")) %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
govuk_publishing_components-55.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-55.0.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-55.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-54.0.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-54.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-53.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-52.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-52.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-51.2.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-51.2.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-51.1.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-46.4.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb