diff --git a/frappe/boot.py b/frappe/boot.py index b6339a4af8..c09e13cdac 100644 --- a/frappe/boot.py +++ b/frappe/boot.py @@ -144,6 +144,7 @@ def load_desktop_data(bootinfo): from frappe.desk.desktop import get_workspace_sidebar_items bootinfo.sidebar_pages = get_workspace_sidebar_items() + allowed_pages = [d.name for d in bootinfo.sidebar_pages.get("pages")] bootinfo.module_wise_workspaces = get_controller("Workspace").get_module_wise_workspaces() bootinfo.dashboards = frappe.get_all("Dashboard") bootinfo.app_data = [] @@ -169,6 +170,7 @@ def load_desktop_data(bootinfo): .where(Module.app_name == app_name) .run() ) + if r[0] in allowed_pages ], ) ) diff --git a/frappe/desk/desktop.py b/frappe/desk/desktop.py index 211820be28..13865eadde 100644 --- a/frappe/desk/desktop.py +++ b/frappe/desk/desktop.py @@ -443,6 +443,7 @@ def get_workspace_sidebar_items(): "icon", "indicator_color", "is_hidden", + "app", ] all_pages = frappe.get_all( "Workspace", fields=fields, filters=filters, order_by=order_by, ignore_permissions=True diff --git a/frappe/desk/doctype/workspace/workspace.json b/frappe/desk/doctype/workspace/workspace.json index c9c68137fe..8813d7e4d8 100644 --- a/frappe/desk/doctype/workspace/workspace.json +++ b/frappe/desk/doctype/workspace/workspace.json @@ -14,6 +14,7 @@ "for_user", "parent_page", "module", + "app", "column_break_3", "icon", "indicator_color", @@ -210,11 +211,16 @@ "fieldtype": "Select", "label": "Indicator Color", "options": "green\ncyan\nblue\norange\nyellow\ngray\ngrey\nred\npink\ndarkgrey\npurple\nlight-blue" + }, + { + "fieldname": "app", + "fieldtype": "Data", + "label": "App" } ], "in_create": 1, "links": [], - "modified": "2024-08-26 17:16:05.820503", + "modified": "2024-09-02 22:30:06.402905", "modified_by": "Administrator", "module": "Desk", "name": "Workspace", diff --git a/frappe/desk/doctype/workspace/workspace.py b/frappe/desk/doctype/workspace/workspace.py index 7f8bcea15b..921e803d37 100644 --- a/frappe/desk/doctype/workspace/workspace.py +++ b/frappe/desk/doctype/workspace/workspace.py @@ -30,6 +30,7 @@ class Workspace(Document): from frappe.desk.doctype.workspace_shortcut.workspace_shortcut import WorkspaceShortcut from frappe.types import DF + app: DF.Data | None charts: DF.Table[WorkspaceChart] content: DF.LongText | None custom_blocks: DF.Table[WorkspaceCustomBlock] @@ -268,6 +269,7 @@ def new_page(new_page): doc.label = page.get("label") doc.for_user = page.get("for_user") doc.public = page.get("public") + doc.app = page.get("app") doc.sequence_id = last_sequence_id(doc) + 1 doc.save(ignore_permissions=True) diff --git a/frappe/public/js/frappe/ui/sidebar.js b/frappe/public/js/frappe/ui/sidebar.js index 6aa5840fd6..1ef2d71ead 100644 --- a/frappe/public/js/frappe/ui/sidebar.js +++ b/frappe/public/js/frappe/ui/sidebar.js @@ -182,7 +182,11 @@ frappe.ui.Sidebar = class Sidebar { let parent_pages = this.all_pages.filter((p) => !p.parent_page).uniqBy((p) => p.title); parent_pages = [ - ...parent_pages.filter((p) => !p.public && app_workspaces.includes(p.title)), + ...parent_pages.filter( + (p) => + !p.public && + (app_workspaces.includes(p.title) || p.app === frappe.current_app || !p.app) + ), ...parent_pages.filter((p) => p.public && app_workspaces.includes(p.title)), ]; @@ -220,11 +224,17 @@ frappe.ui.Sidebar = class Sidebar { } prepare_sidebar(items, child_container, item_container) { + let last_item = null; for (let item of items) { + if (item.public && last_item && !last_item.public) { + $(`
`).appendTo(child_container); + } + // visibility not explicitly set to 0 if (item.visibility !== 0) { this.append_item(item, child_container); } + last_item = item; } child_container.appendTo(item_container); } diff --git a/frappe/public/js/frappe/views/workspace/workspace.js b/frappe/public/js/frappe/views/workspace/workspace.js index d98cbe8eb8..779e230edc 100644 --- a/frappe/public/js/frappe/views/workspace/workspace.js +++ b/frappe/public/js/frappe/views/workspace/workspace.js @@ -506,6 +506,7 @@ frappe.views.Workspace = class Workspace { parent_page: values.parent || "", is_editable: true, selected: true, + app: frappe.current_app, }; this.editor diff --git a/frappe/public/scss/desk/list.scss b/frappe/public/scss/desk/list.scss index 9d97bafc33..33d9afc72d 100644 --- a/frappe/public/scss/desk/list.scss +++ b/frappe/public/scss/desk/list.scss @@ -228,7 +228,11 @@ $level-margin-right: 8px; } } .btn-paging { +<<<<<<< HEAD background-color: var(--control-bg); +======= + background-color: var(--subtle-accent); +>>>>>>> ad3329ead1 (fix(minor): page creation) } } diff --git a/frappe/public/scss/desk/sidebar.scss b/frappe/public/scss/desk/sidebar.scss index d3498100c1..4385782850 100644 --- a/frappe/public/scss/desk/sidebar.scss +++ b/frappe/public/scss/desk/sidebar.scss @@ -104,7 +104,7 @@ body { z-index: 1030; position: static; font-size: var(--text-base); - transition: transform 200ms ease-in-out; + // transition: width 200ms; .app-logo { width: 21px; @@ -114,6 +114,11 @@ body { width: 100%; } + .divider { + margin: var(--margin-md) 0; + border-top: 1px solid var(--border-color); + } + .standard-sidebar-section { margin-bottom: var(--margin-xl); @@ -192,6 +197,12 @@ body { } } +.app-switcher-dropdown { + .sidebar-item-control { + margin-top: -2px; + } +} + .app-switcher-menu { position: absolute; top: 40px; @@ -205,6 +216,11 @@ body { .app-item { padding: var(--padding-xs); + border-radius: var(--border-radius-tiny); + + &:hover { + background-color: var(--subtle-accent); + } a { text-decoration: none; diff --git a/frappe/templates/emails/standard.html b/frappe/templates/emails/standard.html index 2a2093e1e9..8efdd93748 100644 --- a/frappe/templates/emails/standard.html +++ b/frappe/templates/emails/standard.html @@ -18,7 +18,7 @@