Sha256: faffba8966480d62353d2ac6e963e560910ff4bf75cb94faddbcee381ae5570f

Contents?: true

Size: 1.68 KB

Versions: 18

Compression:

Stored size: 1.68 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
  ga4_tracking ||= false
  data_attributes = {}

  if ga4_tracking
    data_attributes[:ga4_devolved_nations_banner] = devolved_nations_helper.ga4_applicable_nations_title_text(true)
    data_attributes[:module] = "ga4-link-tracker"
    data_attributes[:ga4_track_links_only] = ""
    data_attributes[:ga4_set_indexes] = ""
    data_attributes[: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 class: "gem-c-devolved-nations", data: data_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")) %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
govuk_publishing_components-35.21.4 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.21.3 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.21.2 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.21.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.21.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.20.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.20.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.19.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.18.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.17.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.16.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.16.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.5 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.4 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.3 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.2 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.1 app/views/govuk_publishing_components/components/_devolved_nations.html.erb
govuk_publishing_components-35.15.0 app/views/govuk_publishing_components/components/_devolved_nations.html.erb