From 3989040ab6252907429244f16e77ffab7b4d32c0 Mon Sep 17 00:00:00 2001 From: sokumon Date: Thu, 4 Dec 2025 17:25:12 +0530 Subject: [PATCH] fix: always show standard items in sidebar --- frappe/public/js/frappe/ui/sidebar/sidebar.js | 10 ++++++---- frappe/public/js/frappe/ui/sidebar/sidebar_header.js | 6 ++++++ frappe/public/js/frappe/ui/sidebar/sidebar_item.js | 5 ++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar.js b/frappe/public/js/frappe/ui/sidebar/sidebar.js index 293aeb5698..db73945880 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar.js @@ -26,6 +26,7 @@ frappe.ui.Sidebar = class Sidebar { prepare() { try { + this.add_standard_items(); this.sidebar_data = frappe.boot.workspace_sidebar_item[this.workspace_title]; this.workspace_sidebar_items = this.sidebar_data.items; if (this.edit_mode) { @@ -213,7 +214,6 @@ frappe.ui.Sidebar = class Sidebar { } create_sidebar(items) { this.empty(); - this.add_standard_items(items); if (items && items.length > 0) { items.forEach((w) => { if (!w.display_depends_on || frappe.utils.eval(w.display_depends_on)) { @@ -403,9 +403,11 @@ frappe.ui.Sidebar = class Sidebar { if (sidebars.length == 0) { let module_name = router.meta?.module; if (module_name) { - frappe.app.sidebar.setup( - this.sidebar_module_map[module_name][0] || module_name - ); + let sidebar_title = + (this.sidebar_module_map[module_name] && + this.sidebar_module_map[module_name][0]) || + module_name; + frappe.app.sidebar.setup(sidebar_title); } } else { if (this.sidebar_title && sidebars.includes(this.workspace_title)) { diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js index 84f0b5d3ed..997211c63a 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js @@ -99,8 +99,14 @@ frappe.ui.SidebarHeader = class SidebarHeader { false, `var(${this.header_bg_color})` ); + } else { + this.header_icon = this.get_default_icon(); + this.header_icon = ``; } } + get_default_icon() { + return frappe.boot.app_data[0].app_logo_url; + } get_desktop_icon_by_label(title, filters) { if (!filters) { return frappe.boot.desktop_icons.find((f) => f.label === title && f.hidden != 1); diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_item.js b/frappe/public/js/frappe/ui/sidebar/sidebar_item.js index 5c8235249f..bb88ec5f4a 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_item.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_item.js @@ -4,7 +4,10 @@ frappe.ui.sidebar_item.TypeLink = class SidebarItem { this.item = opts.item; this.container = opts.container; this.nested_items = opts.item.nested_items || []; - this.workspace_title = $(".body-sidebar").attr("data-title").toLowerCase(); + this.workspace_title = + ($(".body-sidebar").attr("data-title") && + $(".body-sidebar").attr("data-title").toLowerCase()) || + frappe.app.sidebar.sidebar_title; this.prepare(opts); this.make(); }