Merge pull request #36100 from sokumon/sidebar-prediction
This commit is contained in:
commit
dc2bdb35b0
3 changed files with 11 additions and 16 deletions
|
|
@ -91,6 +91,9 @@ function get_route(desktop_icon) {
|
|||
type: first_link.link_type,
|
||||
name: first_link.link_to,
|
||||
tab: first_link.tab,
|
||||
route_options: {
|
||||
sidebar: desktop_icon.label,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -998,21 +1001,6 @@ class DesktopIcon {
|
|||
}
|
||||
this.icon.attr("href", this.icon_route);
|
||||
}
|
||||
if (this.icon_data.sidebar) {
|
||||
const me = this;
|
||||
this.icon.on("click", function () {
|
||||
if (me.icon_data.sidebar == "My Workspaces") {
|
||||
let sidebar_name = me.icon_data.sidebar.toLowerCase();
|
||||
if (frappe.boot.workspace_sidebar_item[sidebar_name].items.length == 0) {
|
||||
frappe.toast("No Private Workspaces for user");
|
||||
} else {
|
||||
let workspace_name =
|
||||
frappe.boot.workspace_sidebar_item[sidebar_name].items[0]["link_to"];
|
||||
frappe.set_route("Workspaces", "private", workspace_name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render_folder_thumbnail() {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,11 @@ frappe.ui.Sidebar = class Sidebar {
|
|||
setup_events() {
|
||||
const me = this;
|
||||
frappe.router.on("change", function (router) {
|
||||
frappe.app.sidebar.set_workspace_sidebar(router);
|
||||
if (frappe.route_options.sidebar) {
|
||||
frappe.app.sidebar.setup(frappe.route_options.sidebar);
|
||||
} else {
|
||||
frappe.app.sidebar.set_workspace_sidebar(router);
|
||||
}
|
||||
});
|
||||
$(document).on("page-change", function () {
|
||||
frappe.app.sidebar.toggle();
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ frappe.search.AwesomeBar = class AwesomeBar {
|
|||
if (d.type == "Desktop Icon") {
|
||||
target = frappe.utils.get_route_for_icon(d.icon_data);
|
||||
d.route = target;
|
||||
d.route_options = {
|
||||
sidebar: d.icon_data.label,
|
||||
};
|
||||
}
|
||||
let html = `<span>${__(d.label || d.value)}</span>`;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue