Add delete confirmation

This commit is contained in:
Gavin Troy 2023-02-18 21:01:59 +00:00
parent 01c96357ea
commit 212381a5c3
2 changed files with 27 additions and 0 deletions

View file

@ -58,6 +58,11 @@ $(document).ready(function() {
$("#remove-btn").on("click", function(event) { $("#remove-btn").on("click", function(event) {
event.preventDefault(); event.preventDefault();
$('#deletion-modal').modal('show');
});
$("#deletion-confirm-btn").on("click", function(event) {
event.preventDefault();
$.ajax({ $.ajax({
url: window.location.pathname, url: window.location.pathname,

View file

@ -300,6 +300,28 @@
</div> </div>
{{/if}} {{/if}}
{{#if is_created}}
<div class="modal fade hide" id="deletion-modal" tabindex="-1" role="dialog" aria-labelledby="deletion-modal-label" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deletion-modal-label">
<i class="fas fa-trash"></i>
Delete this paste?
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="deletion-modal-close-btn">Cancel</button>
<button type="button" class="btn btn-danger" id="deletion-confirm-btn">Delete</button>
</div>
</div>
</div>
</div>
{{/if}}
<script> <script>
var uri_prefix="{{uri_prefix}}"; var uri_prefix="{{uri_prefix}}";