changeset a5b8d5e43a4a in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=a5b8d5e43a4a
description:
Prevent to open multiple times preference and always call its callback
issue11489
review437501003
diffstat:
src/sao.js | 5 +++--
src/window.js | 3 +--
2 files changed, 4 insertions(+), 4 deletions(-)
diffs (49 lines):
diff -r cb9ce52c320a -r a5b8d5e43a4a src/sao.js
--- a/src/sao.js Wed Oct 19 13:19:26 2022 +0200
+++ b/src/sao.js Sat Oct 22 00:55:58 2022 +0200
@@ -663,7 +663,7 @@
};
Sao.preferences = function() {
- Sao.Tab.tabs.close(true).done(function() {
+ return Sao.Tab.tabs.close(true).then(function() {
jQuery('#user-preferences').empty();
jQuery('#global-search').empty();
jQuery('#menu').empty();
@@ -749,7 +749,8 @@
'title': preferences.status_bar,
}).click(function(evt) {
evt.preventDefault();
- Sao.preferences();
+ user.prop('disabled', true);
+ Sao.preferences().then(() => user.prop('disabled', false));
}).text(preferences.status_bar);
jQuery('#user-preferences').append(user);
if (preferences.avatar_badge_url) {
diff -r cb9ce52c320a -r a5b8d5e43a4a src/window.js
--- a/src/window.js Wed Oct 19 13:19:26 2022 +0200
+++ b/src/window.js Sat Oct 22 00:55:58 2022 +0200
@@ -869,7 +869,6 @@
Sao.Window.Preferences = Sao.class_(Object, {
init: function(callback) {
- this.callback = callback;
var dialog = new Sao.Dialog('Preferences', '', 'lg');
this.el = dialog.modal;
@@ -918,6 +917,7 @@
this.el.modal('show');
};
this.el.on('hidden.bs.modal', function(event) {
+ callback();
jQuery(this).remove();
});
@@ -927,7 +927,6 @@
response: function(response_id) {
const end = () => {
this.destroy();
- this.callback();
};
var prm = jQuery.when();
if (response_id == 'RESPONSE_OK') {