mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 12:09:17 +08:00
Merge pull request #3088 from urbanrotnik/ur-sci-5395-breadcrumbs-order
This commit is contained in:
commit
496c106497
2 changed files with 16 additions and 1 deletions
|
@ -10,4 +10,19 @@ module ProjectFoldersHelper
|
|||
I18n.t('projects.index.modal_move_folder.items.projects_and_folders')
|
||||
end
|
||||
end
|
||||
|
||||
def tree_ordered_parent_folders(current_folder)
|
||||
folders = current_folder&.parent_folders
|
||||
return unless folders
|
||||
|
||||
ordered_folders = [current_folder]
|
||||
folders.each do
|
||||
folder = folders.find { |f| f.id == ordered_folders.last.parent_folder_id }
|
||||
break unless folder
|
||||
|
||||
ordered_folders << folder
|
||||
end
|
||||
|
||||
ordered_folders.reverse
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
data: { projects_cards_url: cards_projects_url,
|
||||
sidebar_url: sidebar_team_path(current_team) }) %>
|
||||
<span>/</span>
|
||||
<% target_folder&.parent_folders&.each do |project_folder| %>
|
||||
<% tree_ordered_parent_folders(target_folder)&.each do |project_folder| %>
|
||||
<%= link_to(project_folder.name,
|
||||
project_folder_path(project_folder),
|
||||
class: 'project-folder-link',
|
||||
|
|
Loading…
Reference in a new issue