Skip to content

Commit

Permalink
add confirmation before delete
Browse files Browse the repository at this point in the history
  • Loading branch information
emnbdx committed Sep 3, 2024
1 parent ffe98cd commit 59f6067
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class="btn btn-success mb-3" data-bs-toggle="tooltip" data-bs-title="Mire d'auth
<?php } ?>
<form method="POST">
<input type="hidden" name="guid" value="<?php echo bin2hex($stream['guid']) ?>"/>
<button type="submit" class="btn btn-danger" name="delete" data-bs-toggle="tooltip" data-bs-title="Suppression">🗑️</button>
<button type="submit" class="btn btn-danger" name="delete" data-bs-toggle="tooltip" data-bs-title="Suppression" onclick="confirmDelete(event)">🗑️</button>
</form>
</td>
</tr>
Expand All @@ -154,6 +154,12 @@ class="btn btn-success mb-3" data-bs-toggle="tooltip" data-bs-title="Mire d'auth
<script>
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))

function confirmDelete(event) {
if (!confirm("Êtes-vous sûr de vouloir supprimer cet élément ? Cette action est irréversible.")) {
event.preventDefault();
}
}
</script>
</body>

Expand Down

0 comments on commit 59f6067

Please sign in to comment.