Sha256: 19223c28eee8782fd3475267548e337e4114fe46e15a5a4d0dd51a88e6bff524

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

<%
  related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns)
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  ga4_tracking ||= false
  data = {}
  data[:module] = "gem-track-click"
  data[:module] << " ga4-link-tracker" if ga4_tracking
  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", data: data) do %>
    <% if local_assigns[:context] != :footer %>
      <h2 id="related-nav-related_items-<%= random %>"
          class="gem-c-related-navigation__main-heading"
          data-track-count="sidebarRelatedItemSection"
          <%= 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,
        ga4_tracking: ga4_tracking %>
    <% end %>
  <% end %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-35.3.4 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.3.3 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.3.2 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.3.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb