filter edit dialog: load rule editor via XHR

This commit is contained in:
Andrew Dolgov 2020-02-28 12:52:20 +03:00
parent 340bb7f392
commit 4f62f5f3f1
1 changed files with 9 additions and 4 deletions

View File

@ -143,9 +143,6 @@ define(["dojo/_base/declare"], function (declare) {
if (dijit.byId("filterNewRuleDlg")) if (dijit.byId("filterNewRuleDlg"))
dijit.byId("filterNewRuleDlg").destroyRecursive(); dijit.byId("filterNewRuleDlg").destroyRecursive();
const query = "backend.php?op=pref-filters&method=newrule&rule=" +
encodeURIComponent(ruleStr);
const rule_dlg = new dijit.Dialog({ const rule_dlg = new dijit.Dialog({
id: "filterNewRuleDlg", id: "filterNewRuleDlg",
title: ruleStr ? __("Edit rule") : __("Add rule"), title: ruleStr ? __("Edit rule") : __("Add rule"),
@ -156,7 +153,15 @@ define(["dojo/_base/declare"], function (declare) {
this.hide(); this.hide();
} }
}, },
href: query content: __('Loading, please wait...'),
});
const tmph = dojo.connect(rule_dlg, "onShow", null, function (e) {
dojo.disconnect(tmph);
xhrPost("backend.php", {op: 'pref-filters', method: 'newrule', rule: ruleStr}, (transport) => {
rule_dlg.attr('content', transport.responseText);
});
}); });
rule_dlg.show(); rule_dlg.show();