Improved logic of list item confirmation by allowing to toggle on/off when clicking on the trash can

This commit is contained in:
Djamil Legato
2022-02-08 20:58:22 -08:00
parent fa4122efcb
commit 0aa99cd3de
2 changed files with 9 additions and 4 deletions

View File

@@ -89,11 +89,14 @@ export default class CollectionsField {
}
confirmRemove(event) {
CollectionsField.closeConfirmations();
const button = $(event.currentTarget);
const list = $(button.closest('.item-actions'));
list.find('.list-confirm-deletion[data-action="delete"]').removeClass('hidden');
const action = list.find('.list-confirm-deletion[data-action="delete"]');
const isHidden = action.hasClass('hidden');
CollectionsField.closeConfirmations();
action[isHidden ? 'removeClass' : 'addClass']('hidden');
}
removeItem(event) {