Merge pull request #5459 from G-Chubinidze/gc_SCI_8404

(A) label for archived projects, inventories and protocol tempates in breadcrumbs [SCI-8404]
This commit is contained in:
aignatov-bio 2023-05-24 10:53:23 +02:00 committed by GitHub
commit 5c3ebc2509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View file

@ -31,6 +31,13 @@ module Breadcrumbs
include_my_module(my_module) if my_module
archived_exists = @breadcrumbs_items.any? { |item| item[:archived] == true }
if params[:view_mode] == 'archived' || archived_exists
@breadcrumbs_items.each do |item|
item[:label] = "(A) #{item[:label]}"
end
end
@breadcrumbs_items
end
end

View file

@ -1173,5 +1173,13 @@ class ProtocolsController < ApplicationController
archived: @protocol.archived?
})
end
archived_exists = @breadcrumbs_items.any? { |item| item[:archived] == true }
if params[:type] == 'archived' || archived_exists
@breadcrumbs_items.each do |item|
item[:label] = "(A) #{item[:label]}"
end
end
end
end

View file

@ -542,5 +542,13 @@ class RepositoriesController < ApplicationController
archived: @repository.archived?
})
end
archived_exists = @breadcrumbs_items.any? { |item| item[:archived] == true }
if params[:archived] == 'true' || archived_exists
@breadcrumbs_items.each do |item|
item[:label] = "(A) #{item[:label]}"
end
end
end
end

View file

@ -1,6 +1,4 @@
<% if @breadcrumbs_items&.length %>
<% archived_exists = @breadcrumbs_items.any? { |item| item[:archived] } %>
<% @breadcrumbs_items.each { |item| item[:label] = "(A) #{item[:label]}" if archived_exists } %>
<% shortened = @breadcrumbs_items.length > 4 %>
<% if shortened %>