fix(minor): page creation

This commit is contained in:
Rushabh Mehta 2024-09-02 23:42:03 +05:30
parent 1cc626ff42
commit c2652fed39
10 changed files with 50 additions and 8 deletions

View file

@ -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
],
)
)

View file

@ -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

View file

@ -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",

View file

@ -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)

View file

@ -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) {
$(`<div class="divider"></div>`).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);
}

View file

@ -506,6 +506,7 @@ frappe.views.Workspace = class Workspace {
parent_page: values.parent || "",
is_editable: true,
selected: true,
app: frappe.current_app,
};
this.editor

View file

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

View file

@ -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;

View file

@ -18,7 +18,7 @@
<td width="40" align="left" valign="middle">
<a href="{{ site_url or 'https://frappeframework.com' }}">
<img
src="{{ brand_logo or '/assets/frappe/images/frappe-framework-logo.png' }}"
src="{{ brand_logo or '/assets/frappe/images/frappe-framework-logo.svg' }}"
height="40"
class="brand-logo"
/>
@ -64,4 +64,4 @@
</table>
</body>
</html>
</html>

View file

@ -1,4 +1,4 @@
<div class="centered splash">
<img src="{{ splash_image or "/assets/frappe/images/frappe-framework-logo.png" }}"
style="max-width: 100px; max-height: 100px;">
</div>
<img src="{{ splash_image or "/assets/frappe/images/frappe-framework-logo.svg" }}"
style="width: 100px; height: 100px;">
</div>