Skip to content
Extraits de code Groupes Projets
Valider 7fc03f34 rédigé par Stefan Giehl's avatar Stefan Giehl
Parcourir les fichiers

Merge pull request #8895 from piwik/8811

Disable save button when clicking on it
parents 18870d27 d94331a2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -17,6 +17,8 @@ $(document).ready(function () {
function updatePluginSettings()
{
$submit.prop('disabled', true);
var $nonce = $('[name="setpluginsettingsnonce"]');
var nonceValue = '';
......@@ -34,7 +36,10 @@ $(document).ready(function () {
ajaxHandler.redirectOnSuccess();
ajaxHandler.setLoadingElement(getLoadingElement());
ajaxHandler.setErrorElement(getErrorElement());
ajaxHandler.send(true);
ajaxHandler.setCompleteCallback(function () {
$submit.prop('disabled', false);
});
ajaxHandler.send();
}
function getSettings()
......
......@@ -99,6 +99,11 @@ function ajaxHelper() {
*/
this.errorCallback = this.defaultErrorCallback;
/**
* Callback function to be executed on complete (after error or success)
*/
this.completeCallback = function () {};
/**
* Params to be passed as GET params
* @type {Object}
......@@ -244,6 +249,16 @@ function ajaxHelper() {
this.errorCallback = callback;
};
/**
* Sets the complete callback which is called after an error or success callback.
*
* @param {function} callback Callback function
* @return {void}
*/
this.setCompleteCallback = function (callback) {
this.completeCallback = callback;
};
/**
* error callback to use by default
*
......@@ -359,6 +374,7 @@ function ajaxHelper() {
async: this.async !== false,
url: url,
dataType: this.format || 'json',
complete: this.completeCallback,
error: function () {
--globalAjaxQueue.active;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter