Fix #17812 - Add missing styles on old confirm modal go/cancel buttons everywhere

Fixes: #17812

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2022-10-19 16:26:17 +02:00
parent a8f6258be3
commit fb7877061e
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
4 changed files with 96 additions and 43 deletions

View File

@ -17,11 +17,6 @@ const DatabaseEvents = {
* @var syntaxHiglighter Reference to the codemirror editor
*/
syntaxHiglighter: null,
/**
* @var buttonOptions Object containing options for
* the jQueryUI dialog buttons
*/
buttonOptions: {},
/**
* Validate editor form fields.
*
@ -100,12 +95,17 @@ const DatabaseEvents = {
if (data.success === true) {
Functions.ajaxRemoveMessage($msg);
/**
* @var button_options Object containing options
* @var buttonOptions Object containing options
* for jQueryUI dialog buttons
*/
var buttonOptions = {};
buttonOptions[Messages.strClose] = function () {
$(this).dialog('close').remove();
var buttonOptions = {
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-primary',
click: function () {
$(this).dialog('close').remove();
},
},
};
/**
* Display the dialog to the user
@ -154,9 +154,23 @@ const DatabaseEvents = {
if (data.success === true) {
// We have successfully fetched the editor form
Functions.ajaxRemoveMessage($msg);
/**
* @var buttonOptions Object containing options
* for jQueryUI dialog buttons
*/
var buttonOptions = {
[Messages.strGo]: {
text: Messages.strGo,
class: 'btn btn-primary',
},
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-secondary',
},
};
// Now define the function that is called when
// the user presses the "Go" button
that.buttonOptions[Messages.strGo] = function () {
buttonOptions[Messages.strGo].click = function () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof CodeMirror !== 'undefined') {
@ -271,7 +285,7 @@ const DatabaseEvents = {
}); // end $.post()
} // end "if (that.validate())"
}; // end of function that handles the submission of the Editor
that.buttonOptions[Messages.strClose] = function () {
buttonOptions[Messages.strClose].click = function () {
$(this).dialog('close');
};
/**
@ -283,7 +297,7 @@ const DatabaseEvents = {
},
width: 700,
minWidth: 500,
buttons: that.buttonOptions,
buttons: buttonOptions,
// Issue #15810 - use button titles for modals (eg: new procedure)
// Respect the order: title on href tag, href content, title sent in response
title: $this.attr('title') || $this.text() || $(data.title).text(),

View File

@ -27,11 +27,6 @@ const DatabaseRoutines = {
* @var syntaxHiglighter Reference to the codemirror editor
*/
syntaxHiglighter: null,
/**
* @var buttonOptions Object containing options for
* the jQueryUI dialog buttons
*/
buttonOptions: {},
/**
* Validate editor form fields.
*
@ -115,12 +110,17 @@ const DatabaseRoutines = {
if (data.success === true) {
Functions.ajaxRemoveMessage($msg);
/**
* @var button_options Object containing options
* @var buttonOptions Object containing options
* for jQueryUI dialog buttons
*/
var buttonOptions = {};
buttonOptions[Messages.strClose] = function () {
$(this).dialog('close').remove();
var buttonOptions = {
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-primary',
click: function () {
$(this).dialog('close').remove();
}
},
};
/**
* Display the dialog to the user
@ -167,11 +167,21 @@ const DatabaseRoutines = {
var $msg = Functions.ajaxShowMessage();
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
if (data.success === true) {
var buttonOptions = {
[Messages.strGo]: {
text: Messages.strGo,
class: 'btn btn-primary',
},
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-secondary',
},
};
// We have successfully fetched the editor form
Functions.ajaxRemoveMessage($msg);
// Now define the function that is called when
// the user presses the "Go" button
that.buttonOptions[Messages.strGo] = function () {
buttonOptions[Messages.strGo].click = function () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof CodeMirror !== 'undefined') {
@ -288,7 +298,7 @@ const DatabaseRoutines = {
}); // end $.post()
} // end "if (that.validate())"
}; // end of function that handles the submission of the Editor
that.buttonOptions[Messages.strClose] = function () {
buttonOptions[Messages.strClose].click = function () {
$(this).dialog('close');
};
/**
@ -301,7 +311,7 @@ const DatabaseRoutines = {
height: 400,
width: 700,
minWidth: 500,
buttons: that.buttonOptions,
buttons: buttonOptions,
// Issue #15810 - use button titles for modals (eg: new procedure)
// Respect the order: title on href tag, href content, title sent in response
title: $this.attr('title') || $this.text() || $(data.title).text(),
@ -749,7 +759,6 @@ const DatabaseRoutines = {
}
},
executeDialog: function ($this) {
var that = this;
/**
* @var msg jQuery object containing the reference to
* the AJAX message shown to the user
@ -763,9 +772,19 @@ const DatabaseRoutines = {
// to get the input parameters for routine, otherwise
// we just show the results of the query
if (data.dialog) {
var buttonOptions = {
[Messages.strGo]: {
text: Messages.strGo,
class: 'btn btn-primary',
},
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-secondary',
},
};
// Define the function that is called when
// the user presses the "Go" button
that.buttonOptions[Messages.strGo] = function () {
buttonOptions[Messages.strGo].click = function () {
/**
* @var data Form data to be sent in the AJAX request
*/
@ -784,7 +803,7 @@ const DatabaseRoutines = {
}
});
};
that.buttonOptions[Messages.strClose] = function () {
buttonOptions[Messages.strClose].click = function () {
$(this).dialog('close');
};
/**
@ -795,7 +814,7 @@ const DatabaseRoutines = {
'ui-dialog-titlebar-close': 'btn-close'
},
width: 650,
buttons: that.buttonOptions,
buttons: buttonOptions,
title: data.title,
modal: true,
close: function () {

View File

@ -16,11 +16,6 @@ const DatabaseTriggers = {
* @var syntaxHiglighter Reference to the codemirror editor
*/
syntaxHiglighter: null,
/**
* @var buttonOptions Object containing options for
* the jQueryUI dialog buttons
*/
buttonOptions: {},
/**
* Validate editor form fields.
*
@ -109,11 +104,16 @@ const DatabaseTriggers = {
if (data.success === true) {
Functions.ajaxRemoveMessage($msg);
/**
* @var button_options Object containing options
* @var buttonOptions Object containing options
* for jQueryUI dialog buttons
*/
var buttonOptions = {};
buttonOptions[Messages.strClose] = function () {
var buttonOptions = {
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-primary',
},
};
buttonOptions[Messages.strClose].click = function () {
$(this).dialog('close').remove();
};
/**
@ -161,11 +161,21 @@ const DatabaseTriggers = {
var $msg = Functions.ajaxShowMessage();
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
if (data.success === true) {
var buttonOptions = {
[Messages.strGo]: {
text: Messages.strGo,
class: 'btn btn-primary',
},
[Messages.strClose]: {
text: Messages.strClose,
class: 'btn btn-secondary',
},
};
// We have successfully fetched the editor form
Functions.ajaxRemoveMessage($msg);
// Now define the function that is called when
// the user presses the "Go" button
that.buttonOptions[Messages.strGo] = function () {
buttonOptions[Messages.strGo].click = function () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof CodeMirror !== 'undefined') {
@ -280,7 +290,7 @@ const DatabaseTriggers = {
}); // end $.post()
} // end "if (that.validate())"
}; // end of function that handles the submission of the Editor
that.buttonOptions[Messages.strClose] = function () {
buttonOptions[Messages.strClose].click = function () {
$(this).dialog('close');
};
/**
@ -292,7 +302,7 @@ const DatabaseTriggers = {
},
width: 700,
minWidth: 500,
buttons: that.buttonOptions,
buttons: buttonOptions,
// Issue #15810 - use button titles for modals (eg: new procedure)
// Respect the order: title on href tag, href content, title sent in response
title: $this.attr('title') || $this.text() || $(data.title).text(),

View File

@ -2793,10 +2793,20 @@ AJAX.registerOnload('functions.js', function () {
var $msgbox = Functions.ajaxShowMessage();
/**
* @var button_options Object containing options to be passed to jQueryUI's dialog
* @var buttonOptions Object containing options to be passed to jQueryUI's dialog
*/
var buttonOptions = {};
buttonOptions[Messages.strGo] = function () {
var buttonOptions = {
[Messages.strGo]: {
text: Messages.strGo,
'class': 'btn btn-primary',
},
[Messages.strCancel]: {
text: Messages.strCancel,
'class': 'btn btn-secondary',
},
};
buttonOptions[Messages.strGo].click = function () {
event.preventDefault();
/**
@ -2833,7 +2843,7 @@ AJAX.registerOnload('functions.js', function () {
}); // end $.post()
};
buttonOptions[Messages.strCancel] = function () {
buttonOptions[Messages.strCancel].click = function () {
$(this).dialog('close');
};
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {