Fix file listing and download for admin shell
`node.parents` is not returning the parent nodes in a fixed order. Hence, we cannot use it but must travers the tree ourselves.
This commit is contained in:
@ -148,7 +148,7 @@ $(document).on('turbolinks:load', function () {
|
||||
}
|
||||
|
||||
// We build the path to the file by concatenating the paths of all parent nodes.
|
||||
let file_path = node.parents.reverse().map(function (id) {
|
||||
let file_path = getParents(jstree, node.parent).map(function (id) {
|
||||
return jstree.get_text(id);
|
||||
}).filter(function (text) {
|
||||
return text !== false;
|
||||
@ -157,6 +157,15 @@ $(document).on('turbolinks:load', function () {
|
||||
return `${node.parent !== '#' ? '/' : ''}${file_path}${node.original.path}`;
|
||||
}
|
||||
|
||||
const getParents = function (jstree, node_id) {
|
||||
debugger;
|
||||
if (node_id === '#') {
|
||||
return ['#'];
|
||||
}
|
||||
|
||||
return getParents(jstree, jstree.get_parent(node_id)).concat([node_id]);
|
||||
}
|
||||
|
||||
const shell = $('#shell');
|
||||
|
||||
if (!shell.isPresent()) {
|
||||
|
Reference in New Issue
Block a user