fix: apps switcher menu is consistent across pages

This commit is contained in:
sokumon 2025-01-16 19:02:23 +05:30
parent f71fb668d4
commit 6561aa37ae
3 changed files with 5 additions and 5 deletions

View file

@ -28,8 +28,8 @@ frappe.ui.AppsSwitcher = class AppsSwitcher {
}
}
}
populate_apps_menu() {
this.add_private_app();
populate_apps_menu(sidebar) {
this.add_private_app(sidebar);
this.add_website_select();
this.add_settings_select();
@ -52,8 +52,8 @@ frappe.ui.AppsSwitcher = class AppsSwitcher {
</div>`).appendTo(this.app_switcher_menu);
}
add_private_app() {
let private_pages = frappe.app.sidebar.all_pages.filter((p) => p.public === 0);
add_private_app(sidebar) {
let private_pages = sidebar.all_pages.filter((p) => p.public === 0);
if (private_pages.length === 0) return;
const app = {

View file

@ -30,6 +30,7 @@ frappe.ui.Sidebar = class Sidebar {
];
this.setup_pages();
this.apps_switcher.populate_apps_menu(this);
}
make_dom() {

View file

@ -48,7 +48,6 @@ frappe.views.Workspace = class Workspace {
this.sidebar = frappe.app.sidebar;
this.app_switcher_menu = frappe.app.app_switcher_menu;
this.sidebar.setup_pages();
this.sidebar.apps_switcher.populate_apps_menu();
this.cached_pages = $.extend(true, {}, frappe.boot.sidebar_pages);
this.has_access = frappe.boot.sidebar_pages.has_access;
this.has_create_access = frappe.boot.sidebar_pages.has_create_access;