Returns the dialog instances that were created and adds an optional close callback.
This commit is contained in:
parent
62f7553ba4
commit
d5de49b5cf
|
@ -36,10 +36,14 @@ var messageHandler = {
|
||||||
* titleKey will be used to get a title via the translation API.
|
* titleKey will be used to get a title via the translation API.
|
||||||
* @param message the message to show. If a falsy value is provided,
|
* @param message the message to show. If a falsy value is provided,
|
||||||
* messageKey will be used to get a message via the translation API.
|
* messageKey will be used to get a message via the translation API.
|
||||||
|
* @param closeFunction function to be called after
|
||||||
|
* the prompt is closed (optional)
|
||||||
|
* @return the prompt that was created, or null
|
||||||
*/
|
*/
|
||||||
openMessageDialog: function(titleKey, messageKey, title, message) {
|
openMessageDialog: function(titleKey, messageKey, title, message,
|
||||||
|
closedFunction) {
|
||||||
if (!popupEnabled)
|
if (!popupEnabled)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
title = APP.translation.generateTranslationHTML(titleKey);
|
title = APP.translation.generateTranslationHTML(titleKey);
|
||||||
|
@ -48,9 +52,13 @@ var messageHandler = {
|
||||||
message = APP.translation.generateTranslationHTML(messageKey);
|
message = APP.translation.generateTranslationHTML(messageKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.prompt(message,
|
return $.prompt(message, {
|
||||||
{title: title, persistent: false}
|
title: title,
|
||||||
);
|
persistent: false,
|
||||||
|
close: function () {
|
||||||
|
if(closedFunction) closedFunction();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Shows a message to the user with two buttons: first is given as a
|
* Shows a message to the user with two buttons: first is given as a
|
||||||
|
@ -69,13 +77,14 @@ var messageHandler = {
|
||||||
* the dialog is opened
|
* the dialog is opened
|
||||||
* @param defaultButton index of default button which will be activated when
|
* @param defaultButton index of default button which will be activated when
|
||||||
* the user press 'enter'. Indexed from 0.
|
* the user press 'enter'. Indexed from 0.
|
||||||
|
* @return the prompt that was created, or null
|
||||||
*/
|
*/
|
||||||
openTwoButtonDialog: function(titleKey, titleString, msgKey, msgString,
|
openTwoButtonDialog: function(titleKey, titleString, msgKey, msgString,
|
||||||
persistent, leftButtonKey, submitFunction, loadedFunction,
|
persistent, leftButtonKey, submitFunction, loadedFunction,
|
||||||
closeFunction, focus, defaultButton) {
|
closeFunction, focus, defaultButton) {
|
||||||
|
|
||||||
if (!popupEnabled || twoButtonDialog)
|
if (!popupEnabled || twoButtonDialog)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
var buttons = [];
|
var buttons = [];
|
||||||
|
|
||||||
|
@ -111,6 +120,7 @@ var messageHandler = {
|
||||||
closeFunction();
|
closeFunction();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return twoButtonDialog;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue