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

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

View file

@ -69,3 +69,7 @@
</section>
{@ $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();
}
});
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();
}
});
});