Sha256: 27c3fb6036b821bc6ba2230a1f7c1e81ace5aadd4566b56e5a8b901fd2b3e857

Contents?: true

Size: 1.99 KB

Versions: 19

Compression:

Stored size: 1.99 KB

Contents

<%
  add_gem_component_stylesheet("step-by-step-nav-related")
  disable_ga4 ||= false
  links ||= []
  pretitle ||= t("components.step_by_step_nav_related.part_of")
  always_display_as_list ||= false
  classes = %w(gem-c-step-nav-related)
  classes << "gem-c-step-nav-related--singular" if links.length == 1
  data = {}
  data[:module] = "ga4-link-tracker" unless disable_ga4
%>
<% if links.any? %>
  <%= tag.div(class: classes, data: data) do %>
    <h2 class="gem-c-step-nav-related__heading">
      <span class="gem-c-step-nav-related__pretitle"><%= pretitle %></span>
      <% if links.length == 1 && !always_display_as_list %>
          <a href="<%= links[0][:href] %>"
            class="govuk-link gem-print-link"
            <% unless disable_ga4
              ga4_attributes = {
                event_name: "navigation",
                type: "part of",
                "index_link": "1",
                index_total: "1",
                section: pretitle,
              }.to_json
            %>
              data-ga4-link="<%= ga4_attributes %>"
            <% end %>
          >
            <%= links[0][:text] %>
          </a>
        </h2>
      <% else %>
        </h2>
        <ul class="gem-c-step-nav-related__links">
          <% links.each_with_index do |link, index| %>
            <li class="gem-c-step-nav-related__link-item">
              <a href="<%= link[:href] %>"
                class="govuk-link gem-print-link"
                <% unless disable_ga4
                  ga4_attributes = {
                    event_name: "navigation",
                    type: "part of",
                    index_link: (index + 1).to_s,
                    index_total: (links.length).to_s,
                    section: pretitle,
                  }.to_json
                %>
                  data-ga4-link="<%= ga4_attributes %>"
                <% end %>
              >
                <%= link[:text] %>
              </a>
            </li>
          <% end %>
        </ul>
      <% 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/_step_by_step_nav_related.html.erb
govuk_publishing_components-45.1.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-45.0.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.11.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.10.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.9.1 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.9.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.8.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.7.1 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.7.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.6.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.5.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.4.2 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.4.1 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.4.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.3.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.2.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.1.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
govuk_publishing_components-44.0.0 app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb