From 078c07d9f5c1c72565fb7b30cad3c22353210693 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 28 Jan 2026 21:33:27 +0900 Subject: [PATCH] Add confirmation dialog before deleting or trashing document in admin dashboard #2653 --- common/lang/en.php | 1 + common/lang/ko.php | 1 + modules/admin/tpl/_dashboard_counter.html | 2 ++ modules/admin/tpl/_dashboard_default.html | 4 ++++ modules/admin/tpl/js/dashboard_default.js | 12 ++++++++++++ 5 files changed, 20 insertions(+) diff --git a/common/lang/en.php b/common/lang/en.php index 80add8d75..b63f049ac 100644 --- a/common/lang/en.php +++ b/common/lang/en.php @@ -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_restore = 'Are you sure you want to restore?'; $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_leave = 'Are you sure you want to delete your account?'; $lang->confirm_update = 'Are you sure you want to update?'; diff --git a/common/lang/ko.php b/common/lang/ko.php index 44225b526..d12c63646 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -307,6 +307,7 @@ $lang->confirm_vote = '추천하시겠습니까?'; $lang->confirm_delete = '삭제하시겠습니까?'; $lang->confirm_restore = '복원하시겠습니까?'; $lang->confirm_move = '이동하시겠습니까?'; +$lang->confirm_trash = '휴지통으로 이동하시겠습니까?'; $lang->confirm_reset = '초기화하시겠습니까?'; $lang->confirm_leave = '탈퇴하시겠습니까?'; $lang->confirm_update = '수정하시겠습니까?'; diff --git a/modules/admin/tpl/_dashboard_counter.html b/modules/admin/tpl/_dashboard_counter.html index ae41c93f2..507e193ba 100644 --- a/modules/admin/tpl/_dashboard_counter.html +++ b/modules/admin/tpl/_dashboard_counter.html @@ -75,6 +75,8 @@ {@ $dashboard_stack->right[] = ob_get_clean()} diff --git a/modules/admin/tpl/js/dashboard_default.js b/modules/admin/tpl/js/dashboard_default.js index 1514d1c33..ce7c5190e 100644 --- a/modules/admin/tpl/js/dashboard_default.js +++ b/modules/admin/tpl/js/dashboard_default.js @@ -10,4 +10,16 @@ $(function() { $(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(); + } + }); });