From 7933a201dd25daec8b5c04c9eaeddd8fb7c14ab8 Mon Sep 17 00:00:00 2001 From: sokumon Date: Thu, 5 Mar 2026 10:58:57 +0530 Subject: [PATCH 1/2] fix: move logout from user avatar to sidebar dropdown --- frappe/hooks.py | 15 ------------ .../public/js/frappe/ui/sidebar/sidebar.html | 24 +++---------------- .../js/frappe/ui/sidebar/sidebar_header.js | 8 +++++++ 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/frappe/hooks.py b/frappe/hooks.py index 7af56e2c19..719d94d3c4 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -471,21 +471,6 @@ get_changelog_feed = "frappe.desk.doctype.changelog_feed.changelog_feed.get_feed export_python_type_annotations = True -standard_navbar_items = [ - { - "item_label": "User Settings", - "item_type": "Action", - "action": "frappe.ui.toolbar.route_to_user()", - "is_standard": 1, - }, - { - "item_label": "Log out", - "item_type": "Action", - "action": "frappe.app.logout()", - "is_standard": 1, - }, -] - standard_help_items = [ { "item_label": "About", diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar.html b/frappe/public/js/frappe/ui/sidebar/sidebar.html index 20458ff16d..9728d3ab16 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar.html +++ b/frappe/public/js/frappe/ui/sidebar/sidebar.html @@ -52,10 +52,10 @@ {%= __("Collapse") %} - - + diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js index c96f210105..95529364ac 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js @@ -76,6 +76,14 @@ frappe.ui.SidebarHeader = class SidebarHeader { label: "Help", icon: "info", items: this.get_help_siblings(), + }, + { + name: "logout", + label: "Logout", + icon: "logout", + onClick: function () { + return frappe.app.logout(); + }, } ); } From fa822b31d4e6b2abfa65657a48910c5067aa9033 Mon Sep 17 00:00:00 2001 From: sokumon Date: Thu, 5 Mar 2026 11:34:17 +0530 Subject: [PATCH 2/2] fix: customize sidebar header via standard navbar_items hook --- frappe/public/js/frappe/ui/menu.js | 19 +++++++++++++------ .../js/frappe/ui/sidebar/sidebar_header.js | 8 +++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frappe/public/js/frappe/ui/menu.js b/frappe/public/js/frappe/ui/menu.js index d918f2740b..dbc40b903f 100644 --- a/frappe/public/js/frappe/ui/menu.js +++ b/frappe/public/js/frappe/ui/menu.js @@ -46,15 +46,22 @@ frappe.ui.menu = class ContextMenu { make() { this.template.empty(); this.menu_items_to_show = []; - this.menu_items.forEach((f) => { - f.condition = - f.condition || + this.menu_items.forEach((item) => { + item.condition = + item.condition || function () { return true; }; - if (f.condition()) { - this.add_menu_item(f); - this.menu_items_to_show.push(f); + console.log(typeof item.condition); + let render = false; + if (typeof item.condition == "function") { + render = item.condition(); + } else { + render = frappe.utils.eval_expression(item.condition); + } + if (render) { + this.add_menu_item(item); + this.menu_items_to_show.push(item); } }); diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js index 95529364ac..c587f3ae1d 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js @@ -87,12 +87,18 @@ frappe.ui.SidebarHeader = class SidebarHeader { } ); } + this.add_navbar_items(); this.make(); this.setup_app_switcher(); this.populate_dropdown_menu(); this.setup_select_options(); } - + add_navbar_items() { + frappe.boot.navbar_settings.settings_dropdown.forEach((item) => { + item.label = item.item_label; + this.dropdown_items.push(item); + }); + } fetch_related_icons() { let sibling_workspaces = []; let workspaces_not_to_show = ["My Workspaces"];