Updates two button dialogs to be only single instance.
This commit is contained in:
parent
b7ad6b606a
commit
62f7553ba4
|
@ -15,6 +15,12 @@ let notificationsEnabled = true;
|
||||||
*/
|
*/
|
||||||
let popupEnabled = true;
|
let popupEnabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently displayed two button dialog.
|
||||||
|
* @type {null}
|
||||||
|
*/
|
||||||
|
let twoButtonDialog = null;
|
||||||
|
|
||||||
var messageHandler = {
|
var messageHandler = {
|
||||||
OK: "dialog.OK",
|
OK: "dialog.OK",
|
||||||
CANCEL: "dialog.Cancel",
|
CANCEL: "dialog.Cancel",
|
||||||
|
@ -68,7 +74,7 @@ var messageHandler = {
|
||||||
persistent, leftButtonKey, submitFunction, loadedFunction,
|
persistent, leftButtonKey, submitFunction, loadedFunction,
|
||||||
closeFunction, focus, defaultButton) {
|
closeFunction, focus, defaultButton) {
|
||||||
|
|
||||||
if (!popupEnabled)
|
if (!popupEnabled || twoButtonDialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var buttons = [];
|
var buttons = [];
|
||||||
|
@ -87,15 +93,23 @@ var messageHandler = {
|
||||||
if (msgKey) {
|
if (msgKey) {
|
||||||
message = APP.translation.generateTranslationHTML(msgKey);
|
message = APP.translation.generateTranslationHTML(msgKey);
|
||||||
}
|
}
|
||||||
$.prompt(message, {
|
twoButtonDialog = $.prompt(message, {
|
||||||
title: title,
|
title: title,
|
||||||
persistent: false,
|
persistent: false,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
defaultButton: defaultButton,
|
defaultButton: defaultButton,
|
||||||
focus: focus,
|
focus: focus,
|
||||||
loaded: loadedFunction,
|
loaded: loadedFunction,
|
||||||
submit: submitFunction,
|
submit: function (e, v, m, f) {
|
||||||
close: closeFunction
|
twoButtonDialog = null;
|
||||||
|
if (submitFunction)
|
||||||
|
submitFunction(e, v, m, f);
|
||||||
|
},
|
||||||
|
close: function () {
|
||||||
|
twoButtonDialog = null;
|
||||||
|
if (closeFunction)
|
||||||
|
closeFunction();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue