From a8409e607ecd2fb6206f1e76414c6fed4af0894c Mon Sep 17 00:00:00 2001 From: Abdeali Chharchhoda Date: Wed, 12 Mar 2025 10:15:44 +0530 Subject: [PATCH] fix: handle AppSwitcher `this` context --- frappe/public/js/frappe/ui/apps_switcher.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/ui/apps_switcher.js b/frappe/public/js/frappe/ui/apps_switcher.js index 0f346cc3db..c02cce121a 100644 --- a/frappe/public/js/frappe/ui/apps_switcher.js +++ b/frappe/public/js/frappe/ui/apps_switcher.js @@ -15,6 +15,7 @@ frappe.ui.AppsSwitcher = class AppsSwitcher { this.app_switcher_menu.toggleClass("hidden"); }); } + create_app_data_map() { frappe.boot.app_data_map = {}; for (var app of frappe.boot.app_data) { @@ -147,11 +148,15 @@ frappe.ui.AppsSwitcher = class AppsSwitcher { // re-render the sidebar frappe.app.sidebar.make_sidebar(); } + set_hover() { - this.app_switcher.on("mouseover", function (event) { + const me = this; + + this.app_switcher.on("mouseover", function () { if ($(this).hasClass("active-sidebar")) return; $(this).addClass("hover"); - if (!this.sidebar.sidebar_expanded) { + + if (!me.sidebar.sidebar_expanded) { $(this).removeClass("hover"); } }); @@ -160,8 +165,10 @@ frappe.ui.AppsSwitcher = class AppsSwitcher { $(this).removeClass("hover"); }); } + set_active() { this.app_switcher.toggleClass("active-sidebar"); + if (!this.sidebar.sidebar_expanded) { this.app_switcher.removeClass("active-sidebar"); }