Sha256: d4c22ec87cb5a89da5a4a857a76075d9c101aba3275cc562a999a282459f02ba

Contents?: true

Size: 1.28 KB

Versions: 164

Compression:

Stored size: 1.28 KB

Contents

<%
  breadcrumbs ||= []
  collapse_on_mobile ||= false
  inverse ||= false
  collapse_class =  collapse_on_mobile && breadcrumbs.any? { |crumb| crumb[:is_page_parent] } ? "gem-c-breadcrumbs--collapse-on-mobile" : ""
  invert_class = inverse ? "gem-c-breadcrumbs--inverse" : ""
  breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs, request.path)
%>

<script type="application/ld+json">
  <%= raw breadcrumb_presenter.structured_data.to_json %>
</script>

<div class="gem-c-breadcrumbs govuk-breadcrumbs <%= invert_class %>" data-module="track-click">
  <ol class="govuk-breadcrumbs__list">
    <% breadcrumbs.each_with_index do |crumb, index| %>
      <% breadcrumb = GovukPublishingComponents::Presenters::Breadcrumb.new(crumb, index) %>
      <li class="govuk-breadcrumbs__list-item" aria-current="<%= breadcrumb.aria_current %>">
        <% if breadcrumb.is_link? %>
          <%= link_to(
            breadcrumb[:title],
            breadcrumb.path,
            data: breadcrumb.tracking_data(breadcrumbs.length),
            class: "govuk-breadcrumbs__link",
            aria: {
              current: breadcrumb.aria_current,
            }
          ) %>
        <% else %>
          <%= breadcrumb[:title] %>
        <% end %>
      </li>
    <% end %>
  </ol>
</div>

Version data entries

164 entries across 164 versions & 1 rubygems

Version Path
govuk_publishing_components-21.22.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.22.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.21.3 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.21.2 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.21.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.21.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.20.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.19.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.19.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.18.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.17.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.16.3 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.16.2 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.16.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.16.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.15.2 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.15.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.15.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.14.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-21.13.5 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb