Merge pull request #35921 from claytonlin1110/fix/sidebar-auto-expand-nested
This commit is contained in:
commit
43393bc4f6
1 changed files with 28 additions and 0 deletions
|
|
@ -155,6 +155,34 @@ frappe.ui.Sidebar = class Sidebar {
|
|||
set_active_workspace_item() {
|
||||
if (this.is_route_in_sidebar()) {
|
||||
this.active_item.addClass("active-sidebar");
|
||||
this.expand_parent_section();
|
||||
}
|
||||
}
|
||||
|
||||
expand_parent_section() {
|
||||
if (!this.active_item) return;
|
||||
let active_section;
|
||||
$(".section-item").each((index, element) => {
|
||||
if (element.contains(this.active_item.get(0))) {
|
||||
active_section = element.dataset.id;
|
||||
}
|
||||
});
|
||||
|
||||
if (active_section) {
|
||||
let section = this.get_item(active_section);
|
||||
if (section) {
|
||||
if (section.collapsed) {
|
||||
section.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_item(name) {
|
||||
for (let item of this.items) {
|
||||
if (item.item.label === name) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue