fix: move dropdown options to sidebar dropdown

This commit is contained in:
sokumon 2025-12-30 17:58:00 +05:30
parent 068a66b70b
commit 9327732b4c
4 changed files with 40 additions and 54 deletions

View file

@ -475,53 +475,6 @@ standard_navbar_items = [
"action": "frappe.ui.toolbar.route_to_user()",
"is_standard": 1,
},
{
"item_label": "Workspace Settings",
"item_type": "Action",
"action": "frappe.quick_edit('Workspace Settings')",
"is_standard": 1,
},
{
"item_label": "Session Defaults",
"item_type": "Action",
"action": "frappe.ui.toolbar.setup_session_defaults()",
"is_standard": 1,
},
{
"item_label": "Reload",
"item_type": "Action",
"action": "frappe.ui.toolbar.clear_cache()",
"is_standard": 1,
},
{
"item_label": "View Website",
"item_type": "Action",
"action": "frappe.ui.toolbar.view_website()",
"is_standard": 1,
},
{
"item_label": "Apps",
"item_type": "Route",
"route": "/apps",
"is_standard": 1,
},
{
"item_label": "Toggle Full Width",
"item_type": "Action",
"action": "frappe.ui.toolbar.toggle_full_width()",
"is_standard": 1,
},
{
"item_label": "Toggle Theme",
"item_type": "Action",
"action": "new frappe.ui.ThemeSwitcher().show()",
"is_standard": 1,
},
{
"item_type": "Separator",
"is_standard": 1,
"item_label": "",
},
{
"item_label": "Log out",
"item_type": "Action",

View file

@ -56,7 +56,9 @@ frappe.ui.menu = class ContextMenu {
? `<img class="logo" src="${item.icon_url}">`
: "";
item_wrapper = $(`<div class="dropdown-menu-item">
item_wrapper = $(`<div class="dropdown-menu-item" onclick="${
item.action ? `return ${item.action}` : ""
}">
<a>
<div class="menu-item-icon" ${!(iconMarkup != "") ? "hidden" : ""}>
${iconMarkup}

View file

@ -42,12 +42,39 @@ frappe.ui.SidebarHeader = class SidebarHeader {
},
];
if (frappe.boot.desk_settings.notifications) {
this.dropdown_items.push({
name: "help",
label: "Help",
icon: "info",
items: this.get_help_siblings(),
});
let is_dark = frappe.ui.get_current_theme() === "dark";
this.dropdown_items.push(
{
name: "help",
label: "Help",
icon: "info",
items: this.get_help_siblings(),
},
{
label: "Session Defaults",
action: "frappe.ui.toolbar.setup_session_defaults()",
is_standard: 1,
icon: "sliders-horizontal",
},
{
label: "Reload",
action: "frappe.ui.toolbar.clear_cache()",
is_standard: 1,
icon: "rotate-ccw",
},
{
label: "Toggle Full Width",
action: "frappe.ui.toolbar.toggle_full_width()",
is_standard: 1,
icon: "maximize",
},
{
label: "Toggle Theme",
action: "new frappe.ui.ThemeSwitcher().show()",
is_standard: 1,
icon: is_dark ? "sun" : "moon",
}
);
}
this.make();
this.setup_app_switcher();

View file

@ -161,3 +161,7 @@ frappe.ui.set_theme = (theme) => {
}
root.setAttribute("data-theme", theme || theme_mode);
};
frappe.ui.get_current_theme = () => {
return document.documentElement.getAttribute("data-theme");
};