Skip to content

Commit

Permalink
Add prompt for permanent deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
trymebytes committed Nov 22, 2024
1 parent 66a521b commit 6f444bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions assets/js/translation-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
}
);

$( '.trash-event-from-list' ).on(
$( '.trash-event-from-list, #delete-permanently' ).on(
'click',
function ( e ) {
e.preventDefault();
if ( confirm( 'Are you sure you want to delete this event?' ) ) {
window.location = $(this).attr('href');
const permanent_delete_clause = 'delete-permanently' == $(this).attr('id') ? 'permanently' : '';
const confirmMessage = `Are you sure you want to ${permanent_delete_clause} delete this event?`;

if ( confirm( confirmMessage ) ) {
window.location = this.href;
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
?>
<a href="<?php echo esc_url( Urls::event_delete( $event->id() ) ); ?>"
class="small-btn is-destructive"
id="delete-permanently"
title="<?php echo esc_attr__( 'Delete permanently', 'gp-translation-events' ); ?>">
<?php echo esc_attr__( 'Delete permanently', 'gp-translation-events' ); ?>
</a>
Expand Down

0 comments on commit 6f444bf

Please sign in to comment.