From b32bcab91f37ed3e20a9c1e2edc448237186cda3 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Tue, 18 Aug 2020 08:06:58 -0500 Subject: [PATCH] add a delete confirmation modal --- web/skins/classic/views/events.php | 22 ++++++++++++++++++++++ web/skins/classic/views/js/events.js | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/web/skins/classic/views/events.php b/web/skins/classic/views/events.php index 4d0e902cd..068ceae5f 100644 --- a/web/skins/classic/views/events.php +++ b/web/skins/classic/views/events.php @@ -303,5 +303,27 @@ while ( $event_row = dbFetchNext($results) ) { + + + + diff --git a/web/skins/classic/views/js/events.js b/web/skins/classic/views/js/events.js index 76f25f666..fe95e5c52 100644 --- a/web/skins/classic/views/js/events.js +++ b/web/skins/classic/views/js/events.js @@ -163,12 +163,32 @@ function initPage() { return; } + var modal = $j('#deleteConfirm'); + var selections = getIdSelections(); + + evt.preventDefault(); + modal.find('.modal-body p').text('You are about to delete '+selections.length+' events. Are you sure?'); + $j('#deleteConfirm').modal('show'); + }); + + // Manage the DELETE CONFIRMATION modal button + document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { + if ( ! canEditEvents ) { + alert("You do not have permission to delete events."); + return; + } + var selections = getIdSelections(); evt.preventDefault(); $j.getJSON(thisUrl + '?view=events&action=delete&eids[]='+selections.join('&eids[]=')); window.location.reload(true); }); + + // Manage the CANCEL modal button + document.getElementById("delCancelBtn").addEventListener("click", function onDelCancelClick(evt) { + $j('#deleteConfirm').modal('hide'); + }); } $j(document).ready(function() {