Effet backup avec bouton wait

This commit is contained in:
Fred Tempez 2021-11-02 18:46:51 +01:00
parent 9273e89431
commit e92100a0d8
2 changed files with 4 additions and 49 deletions

View File

@ -16,45 +16,3 @@
* admin.css
*/
/**
* Effet d'animation
*/
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba( 0, 0, 0, .9 )
url('core/module/config/ressource/ajax-loader.png')
50% 45%
no-repeat;
}
.alertMessage {
color: lightgrey;
display: none;
display: flex;
align-items: center;
justify-content: center;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading .modal .alertMessage {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modal .alertMessage {
display: block;
}

View File

@ -15,8 +15,7 @@ $( document).ready(function() {
$("#configBackupSubmit").addClass("disabled").prop("disabled", true);
e.preventDefault();
if ($("input[name=configBackupOption]").is(':checked')) {
$("body").addClass("loading");
$(".modal").addClass("alertMessage");
$('body').css('cursor', 'wait');
}
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/backup";
$.ajax({
@ -24,17 +23,15 @@ $( document).ready(function() {
url: url,
data: $("form").serialize(),
success: function(data){
$("body").removeClass("loading");
$('body').css('cursor', 'default');
core.alert("La sauvegarde a été générée avec succès.");
},
error: function(data){
$("body").removeClass("loading");
$('body').css('cursor', 'default');
core.alert("Une erreur s'est produite, la sauvegarde n'a pas été générée !");
},
complete: function(){
if ($("input[name=configBackupOption]").is(':checked')) {
$(".modal").removeClass("alertMessage");
}
$("#configBackupSubmit").removeClass("disabled").prop("disabled", false);
}
});