FEAT save button inactive when saving
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2025-04-07 15:08:22 +02:00
parent f0781cd77d
commit 51fa4023c2

View File

@ -94,24 +94,20 @@ add_action('edit_form_after_title', function () {
</div> </div>
<script> <script>
jQuery(function($) { jQuery(function($) {
$('#set-offline-status').on('click', function(e) { $('#save-post-custom').on('click', function(e) {
e.preventDefault(); e.preventDefault();
$('#post_status').val('offline'); const $button = $(this);
$('#post-status-display').text('Hors ligne');
$('#publish').trigger('click');
});
$('#set-online-status').on('click', function(e) { // Désactiver le bouton
e.preventDefault(); $button.prop('disabled', true);
$('#post_status').val('publish');
$('#post-status-display').text('En ligne');
$('#publish').trigger('click');
});
$('#save-post-status').on('click', function(e) { // Déclencher la sauvegarde
e.preventDefault();
// Déclencher la sauvegarde du post
$('#publish').trigger('click'); $('#publish').trigger('click');
// Réactiver le bouton après un délai
setTimeout(function() {
$button.prop('disabled', false);
}, 2000);
}); });
}); });
</script> </script>