fix: create private custom html block
This commit is contained in:
parent
659e4718e8
commit
07781eefe9
2 changed files with 22 additions and 1 deletions
|
|
@ -3,6 +3,18 @@
|
|||
|
||||
frappe.ui.form.on("Custom HTML Block", {
|
||||
refresh(frm) {
|
||||
if (
|
||||
!has_common(frappe.user_roles, [
|
||||
"Administrator",
|
||||
"System Manager",
|
||||
"Workspace Manager",
|
||||
])
|
||||
) {
|
||||
frm.set_value("private", true);
|
||||
} else {
|
||||
frm.set_df_property("private", "read_only", false);
|
||||
}
|
||||
|
||||
let wrapper = frm.fields_dict["preview"].wrapper;
|
||||
wrapper.classList.add("mb-3");
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"private",
|
||||
"preview_section",
|
||||
"preview",
|
||||
"html_section",
|
||||
|
|
@ -80,11 +81,19 @@
|
|||
"fieldtype": "Table",
|
||||
"label": "Roles",
|
||||
"options": "Has Role"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval: doc.private || doc.__unsaved",
|
||||
"fieldname": "private",
|
||||
"fieldtype": "Check",
|
||||
"label": "Private",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-05-29 18:28:28.326843",
|
||||
"modified": "2023-05-30 14:33:31.994738",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Custom HTML Block",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue