fix(minor): sidebar changes
This commit is contained in:
parent
586aa4f16c
commit
561c842a92
3 changed files with 6 additions and 59 deletions
|
|
@ -151,6 +151,7 @@ def load_desktop_data(bootinfo):
|
|||
|
||||
bootinfo.desktop_icons = get_desktop_icons()
|
||||
bootinfo.workspaces = get_workspace_sidebar_items()
|
||||
bootinfo.app_name_style = (frappe.db.get_single_value("Desktop Settings", "show_app_name_in_header"),)
|
||||
bootinfo.workspace_sidebar_item = get_sidebar_items()
|
||||
allowed_pages = [d.name for d in bootinfo.workspaces.get("pages")]
|
||||
bootinfo.module_wise_workspaces = get_controller("Workspace").get_module_wise_workspaces()
|
||||
|
|
@ -539,8 +540,10 @@ def get_sidebar_items():
|
|||
"type": si.type,
|
||||
"icon": si.icon,
|
||||
"child": si.child,
|
||||
# "collapsible": si.collapsible,
|
||||
# "collapsed_by_default": si.collapsed_by_default,
|
||||
"collapsible": si.collapsible,
|
||||
"indent": si.indent,
|
||||
"keep_closed": si.keep_closed,
|
||||
"display_depends_on": si.display_depends_on,
|
||||
}
|
||||
if si.link_type == "Report":
|
||||
report_type, ref_doctype = frappe.db.get_value(
|
||||
|
|
|
|||
|
|
@ -233,62 +233,6 @@ frappe.ui.Sidebar = class Sidebar {
|
|||
});
|
||||
}
|
||||
|
||||
add_toggle_children(item, sidebar_control, item_container) {
|
||||
let $child_item_section = item_container.find(".sidebar-child-item");
|
||||
let drop_icon = "chevron-right";
|
||||
if ($child_item_section.children() > 0) {
|
||||
drop_icon = "small-up";
|
||||
}
|
||||
let $drop_icon = $(`<button class="btn-reset drop-icon hidden">`)
|
||||
.html(frappe.utils.icon(drop_icon, "sm"))
|
||||
.appendTo(sidebar_control);
|
||||
|
||||
if (item.type == "Section Break") {
|
||||
$drop_icon.removeClass("hidden");
|
||||
}
|
||||
this.setup_event_listner(item_container);
|
||||
}
|
||||
setup_event_listner(item_container) {
|
||||
const me = this;
|
||||
let $child_item_section = item_container.find(".sidebar-child-item");
|
||||
let $drop_icon = item_container.find(".drop-icon");
|
||||
$drop_icon.on("click", (e) => {
|
||||
let opened = $drop_icon.find("use").attr("href") === "#icon-chevron-down";
|
||||
|
||||
if (!opened) {
|
||||
$drop_icon
|
||||
.attr("data-state", "closed")
|
||||
.find("use")
|
||||
.attr("href", "#icon-chevron-down");
|
||||
} else {
|
||||
$drop_icon
|
||||
.attr("data-state", "opened")
|
||||
.find("use")
|
||||
.attr("href", "#icon-chevron-right");
|
||||
}
|
||||
$child_item_section.toggleClass("hidden");
|
||||
|
||||
if (e.originalEvent.isTrusted) {
|
||||
if (opened) {
|
||||
this.closed_section_breaks[me.workspace_title] = [];
|
||||
} else {
|
||||
const title = $drop_icon.parent().siblings().attr("title");
|
||||
// Initialize the array if it doesn't exist
|
||||
if (!this.closed_section_breaks[me.workspace_title]) {
|
||||
this.closed_section_breaks[me.workspace_title] = [];
|
||||
}
|
||||
|
||||
// Push the new title into the array
|
||||
this.closed_section_breaks[me.workspace_title].push(title);
|
||||
}
|
||||
localStorage.setItem(
|
||||
"closed-section-breaks",
|
||||
JSON.stringify(this.closed_section_breaks)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
this.sidebar_expanded = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ frappe.ui.sidebar_item.TypeSectionBreak = class SectionBreakSidebarItem extends
|
|||
|
||||
enable_collapsible(item, $item_container) {
|
||||
let sidebar_control = this.$item_control;
|
||||
let drop_icon = "chevron-right";
|
||||
let drop_icon = "chevron-down";
|
||||
if (item.collapsible) {
|
||||
this.$drop_icon = $(`<button class="btn-reset drop-icon hidden">`)
|
||||
.html(frappe.utils.icon(drop_icon, "sm"))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue