Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Nov 16, 2024
1 parent 2b18f43 commit 53c8403
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 18 additions & 1 deletion www/public/resources/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,20 @@ function printAlert(message, type = null, timeout = 3000)
* @param {*} confirmBoxFunction2
* @param {*} confirmBtn2
*/
function confirmBox(message = '', confirmBoxFunction1, confirmBtn1 = 'Delete', confirmBoxFunction2 = null, confirmBtn2 = null)
function confirmBox(message = '', confirmBoxFunction1, confirmBtn1 = 'Delete', confirmBoxFunction2 = null, confirmBtn2 = null, confirmBoxId = null)
{
/**
* If there is already a confirm box with the same id, do nothing
* The Id is used to prevent a same confirm box from being re-opened
*/
if (confirmBoxId != null) {
if ($('#confirm-box').length > 0) {
if ($('#confirm-box').attr('confirm-box-id') == confirmBoxId) {
return;
}
}
}

// Remove any existing confirm box
$("#confirm-box").remove();

Expand Down Expand Up @@ -126,6 +138,11 @@ function confirmBox(message = '', confirmBoxFunction1, confirmBtn1 = 'Delete', c
// Append html to footer
$('footer').append(html);

// Set confirm box id if specified
if (confirmBoxId != null) {
$('#confirm-box').attr('confirm-box-id', confirmBoxId);
}

// Show confirm box
$('#confirm-box').css({
visibility: 'visible'
Expand Down
5 changes: 3 additions & 2 deletions www/public/resources/js/motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,14 @@ $(document).on('click','input[class=event-media-checkbox]',function () {
* Print confirm box to delete selected medias
*/
confirmBox(
'',
'Delete or download selected media(s)',
function () {
deleteMedia(); },
'Delete',
function () {
downloadMedia(); },
'Download'
'Download',
'select-media-confirm'
);

/**
Expand Down

0 comments on commit 53c8403

Please sign in to comment.