mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 02:46:04 +01:00
Improved logic of list item confirmation by allowing to toggle on/off when clicking on the trash can
This commit is contained in:
@@ -89,11 +89,14 @@ export default class CollectionsField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
confirmRemove(event) {
|
confirmRemove(event) {
|
||||||
CollectionsField.closeConfirmations();
|
|
||||||
|
|
||||||
const button = $(event.currentTarget);
|
const button = $(event.currentTarget);
|
||||||
const list = $(button.closest('.item-actions'));
|
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) {
|
removeItem(event) {
|
||||||
|
|||||||
6
themes/grav/js/admin.min.js
vendored
6
themes/grav/js/admin.min.js
vendored
@@ -5756,10 +5756,12 @@ var CollectionsField = /*#__PURE__*/function () {
|
|||||||
}, {
|
}, {
|
||||||
key: "confirmRemove",
|
key: "confirmRemove",
|
||||||
value: function confirmRemove(event) {
|
value: function confirmRemove(event) {
|
||||||
CollectionsField.closeConfirmations();
|
|
||||||
var button = external_jQuery_default()(event.currentTarget);
|
var button = external_jQuery_default()(event.currentTarget);
|
||||||
var list = external_jQuery_default()(button.closest('.item-actions'));
|
var list = external_jQuery_default()(button.closest('.item-actions'));
|
||||||
list.find('.list-confirm-deletion[data-action="delete"]').removeClass('hidden');
|
var action = list.find('.list-confirm-deletion[data-action="delete"]');
|
||||||
|
var isHidden = action.hasClass('hidden');
|
||||||
|
CollectionsField.closeConfirmations();
|
||||||
|
action[isHidden ? 'removeClass' : 'addClass']('hidden');
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "removeItem",
|
key: "removeItem",
|
||||||
|
|||||||
Reference in New Issue
Block a user