From d466284fabe945dbc3c8034ac1468bf97b38ed94 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 12 Feb 2021 09:02:44 +0300 Subject: * customizeCSS: client dialog * remove hardcoded width from most dialogs (move to css) * add helper to easily get dialog from its widget * rework some dialog buttons to use current object instead of calling dialog by name --- js/App.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'js/App.js') diff --git a/js/App.js b/js/App.js index 45de8cf0e..6d7fd1c8b 100644 --- a/js/App.js +++ b/js/App.js @@ -16,6 +16,11 @@ const App = { hotkey_actions: {}, is_prefs: false, LABEL_BASE_INDEX: -1024, + FormFields: { + hidden: function(name, value) { + return `` + } + }, Scrollable: { scrollByPages: function (elem, page_offset) { if (!elem) return; @@ -49,6 +54,9 @@ const App = { elem.offsetTop >= ctr.scrollTop; } }, + dialogOf: function (widget) { + return dijit.getEnclosingWidget(widget.domNode.closest('.dijitDialog')); + }, label_to_feed_id: function(label) { return this.LABEL_BASE_INDEX - 1 - Math.abs(label); }, @@ -300,20 +308,15 @@ const App = { } }, helpDialog: function(topic) { - if (dijit.byId("helpDlg")) - dijit.byId("helpDlg").destroyRecursive(); - - xhrPost("backend.php", {op: "backend", method: "help", topic: topic}, (transport) => { - const dialog = new dijit.Dialog({ - id: "helpDlg", - title: __("Help"), - style: "width: 600px", - content: transport.responseText, - }); - - dialog.show(); - }); - }, + xhrPost("backend.php", {op: "backend", method: "help", topic: topic}, (transport) => { + const dialog = new dijit.Dialog({ + title: __("Help"), + content: transport.responseText, + }); + + dialog.show(); + }); + }, displayDlg: function(title, id, param, callback) { Notify.progress("Loading, please wait...", true); @@ -329,7 +332,6 @@ const App = { dialog = new dijit.Dialog({ title: title, id: 'infoBox', - style: "width: 600px", onCancel: function () { return true; }, @@ -596,7 +598,6 @@ const App = { const dialog = new dijit.Dialog({ id: "exceptionDlg", title: params.title || __("Unhandled exception"), - style: "width: 600px", content: content }); -- cgit v1.2.3