Add confirmation dialog before deleting or trashing document in admin dashboard #2653

This commit is contained in:
Kijin Sung 2026-01-28 21:33:27 +09:00
parent f69dc966c5
commit 078c07d9f5
5 changed files with 20 additions and 0 deletions

View file

@ -307,6 +307,7 @@ $lang->confirm_vote = 'Are you sure you want to upvote?';
$lang->confirm_delete = 'Are you sure you want to delete?'; $lang->confirm_delete = 'Are you sure you want to delete?';
$lang->confirm_restore = 'Are you sure you want to restore?'; $lang->confirm_restore = 'Are you sure you want to restore?';
$lang->confirm_move = 'Are you sure you want to move?'; $lang->confirm_move = 'Are you sure you want to move?';
$lang->confirm_trash = 'Are you sure you want to move to trash?';
$lang->confirm_reset = 'Are you sure you want to reset?'; $lang->confirm_reset = 'Are you sure you want to reset?';
$lang->confirm_leave = 'Are you sure you want to delete your account?'; $lang->confirm_leave = 'Are you sure you want to delete your account?';
$lang->confirm_update = 'Are you sure you want to update?'; $lang->confirm_update = 'Are you sure you want to update?';

View file

@ -307,6 +307,7 @@ $lang->confirm_vote = '추천하시겠습니까?';
$lang->confirm_delete = '삭제하시겠습니까?'; $lang->confirm_delete = '삭제하시겠습니까?';
$lang->confirm_restore = '복원하시겠습니까?'; $lang->confirm_restore = '복원하시겠습니까?';
$lang->confirm_move = '이동하시겠습니까?'; $lang->confirm_move = '이동하시겠습니까?';
$lang->confirm_trash = '휴지통으로 이동하시겠습니까?';
$lang->confirm_reset = '초기화하시겠습니까?'; $lang->confirm_reset = '초기화하시겠습니까?';
$lang->confirm_leave = '탈퇴하시겠습니까?'; $lang->confirm_leave = '탈퇴하시겠습니까?';
$lang->confirm_update = '수정하시겠습니까?'; $lang->confirm_update = '수정하시겠습니까?';

View file

@ -75,6 +75,8 @@
{@ $dashboard_stack->right[] = ob_get_clean()} {@ $dashboard_stack->right[] = ob_get_clean()}
<script> <script>
xe.lang.confirm_delete = '{$lang->confirm_delete}';
xe.lang.confirm_trash = '{$lang->confirm_trash}';
xe.lang.this_week = '{$lang->this_week}'; xe.lang.this_week = '{$lang->this_week}';
xe.lang.last_week = '{$lang->last_week}'; xe.lang.last_week = '{$lang->last_week}';
xe.lang.next_week = '{$lang->next_week}'; xe.lang.next_week = '{$lang->next_week}';

View file

@ -69,3 +69,7 @@
</section> </section>
{@ $dashboard_stack->right[] = ob_get_clean()} {@ $dashboard_stack->right[] = ob_get_clean()}
<script>
xe.lang.confirm_delete = '{$lang->confirm_delete}';
xe.lang.confirm_trash = '{$lang->confirm_trash}';
</script>

View file

@ -10,4 +10,16 @@ $(function() {
$(this).removeClass('hover').find('>.action').hide(); $(this).removeClass('hover').find('>.action').hide();
} }
}); });
var forms = $('.dashboard>div>section form.action');
forms.on('click', 'button', function(e) {
var message;
if ($(this).val() === 'trash' || $(this).val() === 'true') {
message = xe.lang.confirm_trash;
} else {
message = xe.lang.confirm_delete;
}
if (!confirm(message)) {
e.preventDefault();
}
});
}); });