Sha256: e51600d0fd0bfcd76933900a263e461cc44942b2b2ea02b4fed0bf6c07776db0

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

<%
  border ||= false
  breadcrumbs ||= []
  collapse_on_mobile ||= false
  inverse ||= false

  breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)

  classes = %w[gem-c-breadcrumbs govuk-breadcrumbs]
  classes << "govuk-breadcrumbs--collapse-on-mobile" if collapse_on_mobile
  classes << "gem-c-breadcrumbs--inverse" if inverse
  classes << "gem-c-breadcrumbs--border-bottom" if border == "bottom"

  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_class(classes.join(" "))
  component_helper.add_data_attribute({ module: "gem-track-click" })
%>

<script type="application/ld+json">
  <%= raw JSON.pretty_generate(breadcrumb_presenter.structured_data) %>
</script>

<%= tag.div(**component_helper.all_attributes) do %>
  <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">
        <% if breadcrumb.is_link? %>
          <%= link_to(
            breadcrumb[:title],
            breadcrumb.path,
            data: breadcrumb.tracking_data(breadcrumbs.length),
            class: "govuk-breadcrumbs__link",
          ) %>
        <% else %>
          <%= breadcrumb[:title] %>
        <% end %>
        </li>
    <% end %>
  </ol>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govuk_publishing_components-34.10.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-34.10.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-34.9.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-34.9.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-34.8.1 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
govuk_publishing_components-34.8.0 app/views/govuk_publishing_components/components/_breadcrumbs.html.erb