Sha256: b4cd0db68ad85f43272f488ae1bd17a7fd5d29b7aa685a8532e13bc3fb7567fc

Contents?: true

Size: 1.94 KB

Versions: 37

Compression:

Stored size: 1.94 KB

Contents

<%
  related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns)
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  disable_ga4 ||= false
  ga4_type = local_assigns[:context] == :footer ? "contextual footer" : "related content"
  data = {}
  data[:module] = "ga4-link-tracker" unless disable_ga4
  ga4_tracking_counts ||= OpenStruct.new(index_section_count: 0)
  ga4_tracking_counts.index_section_count += related_nav_helper.index_section_count

  add_gem_component_stylesheet("related-navigation")
%>
<% if related_nav_helper.related_navigation? %>
  <% random = SecureRandom.hex(4) %>
  <%= tag.div(class: "gem-c-related-navigation govuk-!-display-none-print", data: data) do %>
    <% if local_assigns[:context] != :footer %>
      <h2 id="related-nav-related_items-<%= random %>"
          class="gem-c-related-navigation__main-heading"
          <%= shared_helper.t_lang(
              "components.related_#{local_assigns[:context]}_navigation.related_content",
              default: 'components.related_navigation.related_content'
            )
          %>
      >
        <%= t("components.related_#{local_assigns[:context]}_navigation.related_content",
              default: t('components.related_navigation.related_content')) %>
      </h2>
    <% end %>

    <% section_index = 0 %>
    <% related_nav_helper.related_navigation.each do |section_title, links| %>
      <% next unless links.any? %>

      <% section_index += 1 %>

      <%= render 'govuk_publishing_components/components/related_navigation/section',
        related_nav_helper: related_nav_helper,
        shared_helper: shared_helper,
        section_title: section_title,
        links: links,
        section_index: section_index,
        section_count: ga4_tracking_counts.index_section_count,
        random: random,
        disable_ga4: disable_ga4,
        ga4_type: ga4_type %>
    <% end %>
  <% end %>
<% end %>

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
govuk_publishing_components-45.7.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.6.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.6.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.5.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.4.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.4.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.3.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.2.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.1.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-45.0.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.11.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.10.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.9.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.9.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.8.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.7.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.7.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.6.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.5.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-44.4.2 app/views/govuk_publishing_components/components/_related_navigation.html.erb