From c5c44472bddfe7fa8c8ff94a5492a593312f5ba2 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Fri, 27 Sep 2024 17:47:55 -0300 Subject: [PATCH] feat: make item delete confirm on click and directly delete on shift+click This behavior is similar to how Discord handles the delete button --- .../transactions/fragments/item.html | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/templates/transactions/fragments/item.html b/app/templates/transactions/fragments/item.html index 0f40201..f6e4a90 100644 --- a/app/templates/transactions/fragments/item.html +++ b/app/templates/transactions/fragments/item.html @@ -63,20 +63,22 @@ hover:tw-bg-zinc-900 p-2 {% if transaction.account.is_asset %}tw-border-dashed{% on mouseenter call bootstrap.Tooltip.getOrCreateInstance(me) end on mouseleave call bootstrap.Tooltip.getOrCreateInstance(me).dispose() end on click - call Swal.fire({title: '{% translate 'Are you sure?' %}', - text: '{% blocktranslate %}You won\'t be able to revert this!{% endblocktranslate %}', - icon: 'warning', - showCancelButton: true, - confirmButtonColor: '#3085d6', - cancelButtonColor: '#d33', - cancelButtonText: '{% blocktranslate %}Cancel{% endblocktranslate %}', - confirmButtonText: '{% blocktranslate %}Yes, delete it!{% endblocktranslate %}', - customClass: { - confirmButton: 'btn btn-primary me-3', - cancelButton: 'btn btn-danger' - }, - buttonsStyling: false}) - if result.isConfirmed trigger confirmed"> + if event.shiftKey trigger confirmed + else + call Swal.fire({title: '{% translate 'Are you sure?' %}', + text: '{% blocktranslate %}You won\'t be able to revert this!{% endblocktranslate %}', + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + cancelButtonText: '{% blocktranslate %}Cancel{% endblocktranslate %}', + confirmButtonText: '{% blocktranslate %}Yes, delete it!{% endblocktranslate %}', + customClass: { + confirmButton: 'btn btn-primary me-3', + cancelButton: 'btn btn-danger' + }, + buttonsStyling: false}) + if result.isConfirmed trigger confirmed">