feat(comms): warning before deletion

This commit is contained in:
mrilyew 2025-05-25 10:56:39 +03:00 committed by Alexander Minkin
parent e7faa45050
commit 8d01f9b0f3
2 changed files with 16 additions and 1 deletions

View file

@ -44,7 +44,7 @@
{if !$timeOnly}
{if $comment->canBeDeletedBy($thisUser)}
|
<a href="/comment{$comment->getId()}/delete">{_delete}</a>
<a href="/comment{$comment->getId()}/delete" id="_ajaxDelete">{_delete}</a>
{/if}
{if $comment->canBeEditedBy($thisUser)}
|

View file

@ -606,6 +606,21 @@ function reportClub(club_id) {
]);
}
$(document).on("click", "#_ajaxDelete", function(e) {
MessageBox(tr('warning'), tr('question_confirm'), [
tr('yes'),
tr('no')
], [
() => {
window.router.route(e.target.href)
},
Function.noop
]);
e.stopPropagation()
return e.preventDefault();
});
$(document).on("click", "#_photoDelete, #_videoDelete, #_anotherDelete", function(e) {
var formHtml = "<form id='tmpPhDelF' action='" + u(this).attr("href") + "' >";
formHtml += "<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />";