Merge pull request #5664 from G-Chubinidze/gc_SCI_8476

Breadcrumbs on label/protocol template page [SCI-8476]
This commit is contained in:
artoscinote 2023-06-26 13:00:19 +02:00 committed by GitHub
commit fa60cb6589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 32 deletions

View file

@ -19,6 +19,10 @@
&:last-child {
color: var(--sn-grey);
}
&.plain-text {
color: var(--sn-grey);
}
}
.delimiter {

View file

@ -207,7 +207,6 @@ class LabelTemplatesController < ApplicationController
@breadcrumbs_items.push({
label: t('breadcrumbs.templates'),
url: label_templates_path
})
@breadcrumbs_items.push({

View file

@ -1164,7 +1164,6 @@ class ProtocolsController < ApplicationController
@breadcrumbs_items.push({
label: t('breadcrumbs.templates'),
url: archived_branch ? protocols_path(type: :archived) : protocols_path,
archived: archived_branch
})

View file

@ -44,41 +44,27 @@
<%= 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 %>
<% last_item = @breadcrumbs_items.pop %>
<% @breadcrumbs_items.each do |item| %>
<%= link_to(item[:label], item[:url],
class: "breadcrumbs-link",
title: item[:label]) %>
<% if item[:url] %>
<%= link_to(item[:label], item[:url],
class: "breadcrumbs-link",
title: item[:label]) %>
<% else %>
<%= content_tag(:span, item[:label],
class: "breadcrumbs-link plain-text",
title: item[:label]) %>
<% end %>
<span class="delimiter">
<img src="<%= asset_path "icon_small/navigate_next.svg"%>"
alt="navigate next"
class="navigate_next">
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 %>
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
<%= last_item[:label] %>
</span>
<% end %>
<% end %>