mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-12 08:04:34 +08:00
logic refactor, url removal
This commit is contained in:
parent
828e566698
commit
ef94a4f2bb
4 changed files with 17 additions and 34 deletions
|
@ -19,6 +19,10 @@
|
|||
&:last-child {
|
||||
color: var(--sn-grey);
|
||||
}
|
||||
|
||||
&.plain-text {
|
||||
color: var(--sn-grey);
|
||||
}
|
||||
}
|
||||
|
||||
.delimiter {
|
||||
|
|
|
@ -207,7 +207,6 @@ class LabelTemplatesController < ApplicationController
|
|||
|
||||
@breadcrumbs_items.push({
|
||||
label: t('breadcrumbs.templates'),
|
||||
url: label_templates_path
|
||||
})
|
||||
|
||||
@breadcrumbs_items.push({
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
@ -45,45 +45,26 @@
|
|||
</span>
|
||||
<% else %>
|
||||
<% last_item = @breadcrumbs_items.pop %>
|
||||
<% template_paths = [/^\/protocols\/\d+$/, /^\/label_templates\/\d+$/] %>
|
||||
<% @breadcrumbs_items.each do |item| %>
|
||||
<% 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 %>
|
||||
|
||||
<% if template_paths.any? { |pattern| request.path.match?(pattern) } || ["/protocols", "/label_templates"].include?(request.path) %>
|
||||
<span class="breadcrumbs-link" style="color: var(--sn-grey);" title="<%= @breadcrumbs_items.first[:label] %>">
|
||||
<%= @breadcrumbs_items.first[:label] %>
|
||||
</span>
|
||||
<span class="delimiter">
|
||||
<img src="<%= asset_path "icon_small/navigate_next.svg"%>"
|
||||
alt="navigate next"
|
||||
class="navigate_next">
|
||||
</span>
|
||||
<% @breadcrumbs_items.each do |item| %>
|
||||
<%= next if @breadcrumbs_items.first == 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 %>
|
||||
<% else %>
|
||||
<% @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 %>
|
||||
<% 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 %>
|
||||
|
|
Loading…
Add table
Reference in a new issue