fix: do not show delete button for standard workspace if developer_mode is not on
This commit is contained in:
parent
4654db6e26
commit
6f8fd738c4
1 changed files with 19 additions and 3 deletions
|
|
@ -719,13 +719,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")}">
|
||||
|
|
@ -767,6 +770,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