fix: handle AppSwitcher this context

This commit is contained in:
Abdeali Chharchhoda 2025-03-12 10:15:44 +05:30
parent 2b9aa25520
commit a8409e607e

View file

@ -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");
}