mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
84 lines
3.2 KiB
Text
84 lines
3.2 KiB
Text
<% if @breadcrumbs_items&.length %>
|
|
<% shortened = @breadcrumbs_items.length > 4 %>
|
|
|
|
<% if shortened %>
|
|
<% first_breadcrumb_item = @breadcrumbs_items.shift
|
|
last_breadcrumb_items = @breadcrumbs_items.pop(2) %>
|
|
<%= link_to(first_breadcrumb_item[:label], first_breadcrumb_item[:url],
|
|
class: "breadcrumbs-link",
|
|
title: first_breadcrumb_item[:label]) %>
|
|
<span class="delimiter">
|
|
<%= image_tag "icon_small/navigate_next.svg",
|
|
alt: "navigate next",
|
|
class: "navigate_next" %>
|
|
</span>
|
|
<span class="breadcrumbs-collapsed-container">
|
|
<span class="show-breadcrumbs" data-toggle="dropdown" title="<%= t('projects.index.breadcrumbs_collapsed') %>">
|
|
•••
|
|
<span class="caret pull-right"></span>
|
|
</span>
|
|
<ul class="dropdown-menu breadcrumbs-dropdown" role="menu">
|
|
<% @breadcrumbs_items.each do |item| %>
|
|
<li>
|
|
<%= link_to(item[:label], item[:url]) %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</span>
|
|
<span class="delimiter">
|
|
<%= image_tag "icon_small/navigate_next.svg",
|
|
alt: "navigate next",
|
|
class: "navigate_next" %>
|
|
</span>
|
|
<% item = last_breadcrumb_items.first %>
|
|
<%= link_to(item[:label], item[:url],
|
|
class: "breadcrumbs-link",
|
|
title: item[:label]) %>
|
|
<span class="delimiter">
|
|
<%= image_tag "icon_small/navigate_next.svg",
|
|
alt: "navigate next",
|
|
class: "navigate_next" %>
|
|
</span>
|
|
<% last_item = last_breadcrumb_items.last %>
|
|
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
|
<%= last_item[:label] %>
|
|
</span>
|
|
<% else %>
|
|
<% template_paths = [/^\/protocols\/\d+$/, /^\/label_templates\/\d+$/] %>
|
|
<% if template_paths.any? { |pattern| request.path.match?(pattern) }%>
|
|
<% last_breadcrumb_items = @breadcrumbs_items.pop(2) %>
|
|
<% else %>
|
|
<% last_item = @breadcrumbs_items.pop %>
|
|
<% end %>
|
|
|
|
<% @breadcrumbs_items.each do |item| %>
|
|
<%= link_to(item[:label], item[:url],
|
|
class: "breadcrumbs-link",
|
|
title: item[:label]) %>
|
|
<span class="delimiter">
|
|
<img src="<%= asset_path "icon_small/navigate_next.svg"%>"
|
|
alt="navigate next"
|
|
class="navigate_next">
|
|
</span>
|
|
<% end %>
|
|
|
|
<% if last_breadcrumb_items %>
|
|
<span class="breadcrumbs-link" style="color: var(--sn-grey);" title="<%= last_breadcrumb_items.first[:label] %>">
|
|
<%= last_breadcrumb_items.first[:label] %>
|
|
</span>
|
|
<span class="delimiter">
|
|
<img src="<%= asset_path "icon_small/navigate_next.svg"%>"
|
|
alt="navigate next"
|
|
class="navigate_next">
|
|
</span>
|
|
<span class="breadcrumbs-link" style="color: var(--sn-grey);" title="<%= last_breadcrumb_items.last[:label] %>">
|
|
<%= last_breadcrumb_items.last[:label] %>
|
|
</span>
|
|
<% end %>
|
|
<% if last_item %>
|
|
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
|
<%= last_item[:label] %>
|
|
</span>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|