noesya/osuny

View on GitHub
app/views/admin/application/static/_breadcrumbs.html.erb

Summary

Maintainability
Test Coverage
<%
last_item ||= nil
if @website
  localizations = about.hugo_ancestors_and_self(@website)
%>
breadcrumbs:
<%
localizations.each do |l10n|
  # Les pages (Communication::Website::Page::Localization) ont une gymnastique un peu spéciale,
  # parce qu'il faut prendre le titre dédié au breadcrumb.
  if l10n.respond_to?(:best_breadcrumb_title)
    title = l10n.best_breadcrumb_title
  else
    title = l10n.to_s
  end
  hugo = l10n.hugo(@website)
  permalink = hugo.permalink
  last = l10n == localizations.last
%>
  - title: >-
      <%= title %>
<% if !last || last_item.present? %>
    path: "<%= permalink %>"
<% end %>
<% end %>
<% if last_item.present? %>
  - title: <%= last_item %>
<% end %>
<% end %>