Merge pull request #19510 from shariquerik/delete-standard-workspace-fix
This commit is contained in:
commit
32ea734e9c
3 changed files with 27 additions and 6 deletions
|
|
@ -41,6 +41,10 @@ frappe.ui.form.on("Workspace", {
|
|||
}
|
||||
}
|
||||
|
||||
if (frappe.boot.developer_mode) {
|
||||
frm.set_df_property("module", "read_only", 0);
|
||||
}
|
||||
|
||||
frm.layout.show_message(message);
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@
|
|||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Module",
|
||||
"options": "Module Def"
|
||||
"options": "Module Def",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
|
|
@ -177,7 +178,7 @@
|
|||
],
|
||||
"in_create": 1,
|
||||
"links": [],
|
||||
"modified": "2023-01-05 16:22:42.593601",
|
||||
"modified": "2023-01-07 17:02:48.278025",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Workspace",
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ frappe.views.Workspace = class Workspace {
|
|||
frappe.show_alert({ message: __("Customizations Discarded"), indicator: "info" });
|
||||
});
|
||||
|
||||
if (page.name && frappe.perm.has_perm("Workspace", 0, "read")) {
|
||||
if (page.name && this.has_access) {
|
||||
this.page.add_inner_button(__("Settings"), () => {
|
||||
frappe.set_route(`workspace/${page.name}`);
|
||||
});
|
||||
|
|
@ -720,13 +720,16 @@ frappe.views.Workspace = class Workspace {
|
|||
icon: frappe.utils.icon("duplicate", "sm"),
|
||||
action: () => this.duplicate_page(item),
|
||||
},
|
||||
{
|
||||
];
|
||||
|
||||
if (this.is_item_deletable(item)) {
|
||||
this.dropdown_list.push({
|
||||
label: __("Delete"),
|
||||
title: __("Delete Workspace"),
|
||||
icon: frappe.utils.icon("delete-active", "sm"),
|
||||
action: () => this.delete_page(item),
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
let $button = $(`
|
||||
<div class="btn btn-secondary btn-xs setting-btn dropdown-btn" title="${__("Setting")}">
|
||||
|
|
@ -768,6 +771,19 @@ frappe.views.Workspace = class Workspace {
|
|||
});
|
||||
}
|
||||
|
||||
is_item_deletable(item) {
|
||||
// if item is private
|
||||
// if item is public but doesn't have module set
|
||||
// if item is public and has module set but developer mode is on
|
||||
// then item is deletable
|
||||
if (
|
||||
!item.public ||
|
||||
(item.public && (!item.module || (item.module && frappe.boot.developer_mode)))
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete_page(page) {
|
||||
frappe.confirm(
|
||||
__("Are you sure you want to delete page {0}?", [page.title.bold()]),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue