From 4f62f5f3f1235bdbb5f71f0cda1dbf6c836cd1f3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Feb 2020 12:52:20 +0300 Subject: [PATCH] filter edit dialog: load rule editor via XHR --- js/CommonFilters.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/CommonFilters.js b/js/CommonFilters.js index 01ffc4a5e..1e8b1d0b3 100644 --- a/js/CommonFilters.js +++ b/js/CommonFilters.js @@ -143,9 +143,6 @@ define(["dojo/_base/declare"], function (declare) { if (dijit.byId("filterNewRuleDlg")) dijit.byId("filterNewRuleDlg").destroyRecursive(); - const query = "backend.php?op=pref-filters&method=newrule&rule=" + - encodeURIComponent(ruleStr); - const rule_dlg = new dijit.Dialog({ id: "filterNewRuleDlg", title: ruleStr ? __("Edit rule") : __("Add rule"), @@ -156,7 +153,15 @@ define(["dojo/_base/declare"], function (declare) { 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();