mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-09 14:13:16 +08:00
Merge pull request #7352 from wandji20/wb-SCI-10513
Fix issue loading navigator [SCI-10513]
This commit is contained in:
commit
b8a69f2d18
1 changed files with 3 additions and 1 deletions
|
@ -24,7 +24,7 @@ module Navigator
|
||||||
url: project_folder_path(folder, view_mode: archived ? 'archived' : 'active'),
|
url: project_folder_path(folder, view_mode: archived ? 'archived' : 'active'),
|
||||||
archived: folder.archived,
|
archived: folder.archived,
|
||||||
type: :folder,
|
type: :folder,
|
||||||
has_children: folder.has_children,
|
has_children: folder.try(:has_children),
|
||||||
children_url: navigator_project_folder_path(folder)
|
children_url: navigator_project_folder_path(folder)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -180,6 +180,8 @@ module Navigator
|
||||||
archived = params[:archived] == 'true'
|
archived = params[:archived] == 'true'
|
||||||
tree = fetch_projects(folder.parent_folder, archived).map { |i| project_serializer(i, archived) } +
|
tree = fetch_projects(folder.parent_folder, archived).map { |i| project_serializer(i, archived) } +
|
||||||
fetch_project_folders(folder.parent_folder, archived).map { |i| folder_serializer(i, archived) }
|
fetch_project_folders(folder.parent_folder, archived).map { |i| folder_serializer(i, archived) }
|
||||||
|
# Tree will not contain folder when folder archived state and params archived values are contradictory
|
||||||
|
tree.find { |i| i[:id] == folder.code } || (tree << folder_serializer(folder, archived))
|
||||||
tree.find { |i| i[:id] == folder.code }[:children] = children
|
tree.find { |i| i[:id] == folder.code }[:children] = children
|
||||||
tree = build_folder_tree(folder.parent_folder, tree) if folder.parent_folder.present?
|
tree = build_folder_tree(folder.parent_folder, tree) if folder.parent_folder.present?
|
||||||
tree
|
tree
|
||||||
|
|
Loading…
Reference in a new issue