mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-14 18:23:55 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io> fix(demo): removed toolbar eventlistener (#52171)
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
frappe.provide("erpnext.demo");
|
frappe.provide("erpnext.demo");
|
||||||
|
|
||||||
$(document).on("toolbar_setup", function () {
|
|
||||||
if (frappe.boot.sysdefaults.demo_company) {
|
|
||||||
render_clear_demo_action();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on("desktop_screen", function (event, data) {
|
$(document).on("desktop_screen", function (event, data) {
|
||||||
data.desktop.add_menu_item({
|
data.desktop.add_menu_item({
|
||||||
label: __("Clear Demo Data"),
|
label: __("Clear Demo Data"),
|
||||||
@@ -19,16 +13,6 @@ $(document).on("desktop_screen", function (event, data) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function render_clear_demo_action() {
|
|
||||||
let demo_action = $(
|
|
||||||
`<a class="dropdown-item" onclick="return erpnext.demo.clear_demo()">
|
|
||||||
${__("Clear Demo Data")}
|
|
||||||
</a>`
|
|
||||||
);
|
|
||||||
|
|
||||||
demo_action.appendTo($("#toolbar-user"));
|
|
||||||
}
|
|
||||||
|
|
||||||
erpnext.demo.clear_demo = function () {
|
erpnext.demo.clear_demo = function () {
|
||||||
frappe.confirm(__("Are you sure you want to clear all demo data?"), () => {
|
frappe.confirm(__("Are you sure you want to clear all demo data?"), () => {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
|
|||||||
Reference in New Issue
Block a user