summaryrefslogtreecommitdiff
path: root/js/PrefUsers.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/PrefUsers.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/PrefUsers.js')
-rw-r--r--js/PrefUsers.js42
1 files changed, 19 insertions, 23 deletions
diff --git a/js/PrefUsers.js b/js/PrefUsers.js
index a332a9140..0a7e635fe 100644
--- a/js/PrefUsers.js
+++ b/js/PrefUsers.js
@@ -1,7 +1,7 @@
'use strict'
/* global __ */
-/* global xhrPost, dojo, dijit, Notify, Tables */
+/* global xhrPost, dojo, dijit, Notify, Tables, fox */
const Users = {
reload: function(sort) {
@@ -27,29 +27,25 @@ const Users = {
}
},
edit: function(id) {
- const query = "backend.php?op=pref-users&method=edit&id=" +
- encodeURIComponent(id);
-
- if (dijit.byId("userEditDlg"))
- dijit.byId("userEditDlg").destroyRecursive();
-
- const dialog = new dijit.Dialog({
- id: "userEditDlg",
- title: __("User Editor"),
- execute: function () {
- if (this.validate()) {
- Notify.progress("Saving data...", true);
-
- xhrPost("backend.php", dojo.formToObject("user_edit_form"), (/* transport */) => {
- dialog.hide();
- Users.reload();
- });
- }
- },
- href: query
- });
+ xhrPost('backend.php', {op: 'pref-users', method: 'edit', id: id}, (transport) => {
+ const dialog = new fox.SingleUseDialog({
+ id: "userEditDlg",
+ title: __("User Editor"),
+ execute: function () {
+ if (this.validate()) {
+ Notify.progress("Saving data...", true);
+
+ xhrPost("backend.php", dojo.formToObject("user_edit_form"), (/* transport */) => {
+ dialog.hide();
+ Users.reload();
+ });
+ }
+ },
+ content: transport.responseText
+ });
- dialog.show();
+ dialog.show();
+ });
},
resetSelected: function() {
const rows = this.getSelection();