Sha256: 141da015ddaf908b5b3fe623becdaef0c2310901abb0b66155a2ce20a0f590f9

Contents?: true

Size: 1.69 KB

Versions: 7

Compression:

Stored size: 1.69 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
%>

<%
  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,
        random: random,
        ga4_tracking: ga4_tracking %>
    <% end %>
  <% end %>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
govuk_publishing_components-35.3.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.2.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.1.1 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.1.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-35.0.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-34.14.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb
govuk_publishing_components-34.13.0 app/views/govuk_publishing_components/components/_related_navigation.html.erb