summaryrefslogtreecommitdiff
path: root/js/PrefHelpers.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-12 15:22:10 +0300
committerAndrew Dolgov <[email protected]>2021-02-12 15:22:10 +0300
commit3d11c61f326ef133427f6f37de4429e879c725f2 (patch)
tree472a31623e184383ae61d189662fb29a3808f454 /js/PrefHelpers.js
parent219cc9a0ab0da20cb82df2647508e29f7f9d1515 (diff)
* OPML import: don't reload everything, just feed tree
* dialogs: use auto-destroying dialog for almost all dialogs instead of destroying them manually * some general dialog-related cleanup
Diffstat (limited to 'js/PrefHelpers.js')
-rw-r--r--js/PrefHelpers.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index dd8fef5c6..4e0161625 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -1,6 +1,6 @@
'use strict';
-/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App */
+/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App, fox */
const Helpers = {
AppPasswords: {
@@ -83,14 +83,7 @@ const Helpers = {
},
},
editProfiles: function() {
-
- if (dijit.byId("profileEditDlg"))
- dijit.byId("profileEditDlg").destroyRecursive();
-
- const query = "backend.php?op=pref-prefs&method=editPrefProfiles";
-
- // noinspection JSUnusedGlobalSymbols
- const dialog = new dijit.Dialog({
+ const dialog = new fox.SingleUseDialog({
id: "profileEditDlg",
title: __("Settings Profiles"),
getSelectedProfiles: function () {
@@ -110,7 +103,7 @@ const Helpers = {
xhrPost("backend.php", query, () => {
Notify.close();
- Helpers.editProfiles();
+ dialog.refresh();
});
}
@@ -126,11 +119,16 @@ const Helpers = {
xhrPost("backend.php", query, () => {
Notify.close();
- Helpers.editProfiles();
+ dialog.refresh();
});
}
},
+ refresh: function() {
+ xhrPost("backend.php", {op: 'pref-prefs', method: 'editPrefProfiles'}, (transport) => {
+ dialog.attr('content', transport.responseText);
+ });
+ },
execute: function () {
const sel_rows = this.getSelectedProfiles();
@@ -147,15 +145,16 @@ const Helpers = {
alert(__("Please choose a profile to activate."));
}
},
- href: query
+ content: ""
});
+ dialog.refresh();
dialog.show();
},
customizeCSS: function() {
xhrJson("backend.php", {op: "pref-prefs", method: "customizeCSS"}, (reply) => {
- const dialog = new dijit.Dialog({
+ const dialog = new fox.SingleUseDialog({
title: __("Customize stylesheet"),
apply: function() {
xhrPost("backend.php", this.attr('value'), () => {
@@ -245,13 +244,15 @@ const Helpers = {
xhr.onload = function () {
Notify.close();
- const dialog = new dijit.Dialog({
+ const dialog = new fox.SingleUseDialog({
title: __("OPML Import"),
onCancel: function () {
- window.location.reload();
+ this.execute();
},
execute: function () {
- window.location.reload();
+ const tree = dijit.byId('feedTree');
+
+ if (tree) tree.reload();
},
content: `
<div class='alert alert-info'>