Sha256: 81e1427f28f8f95f9b361d5baa88c8c6ca78ffb80fb41eb71c913112fc584e60

Contents?: true

Size: 1.79 KB

Versions: 19

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-print-link")) %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
govuk_publishing_components-45.2.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-45.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-45.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.11.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.10.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.9.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.9.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.8.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.7.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.7.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.6.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.5.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.4.2 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.4.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.4.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.3.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.2.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.1.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-44.0.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb