Property-Action for Remove All Entries in Nested Content (#7036)

* Property-Action for remove all entries from Nested Content
* Add "delete all items" confirmation and rephrase action link a bit
* Enforce "delete" confirmation type in overlayService.confirmDelete
* rename to controller for easier to solve merge conflicts
* update removeAllEntriesAction.isDisabled when content changes
* minor correction
This commit is contained in:
Niels Lyngsø
2019-11-26 13:59:37 +01:00
committed by GitHub
parent 37c668b4a8
commit 4b8ea94991
5 changed files with 2375 additions and 2339 deletions

View File

@@ -89,6 +89,7 @@
}
function confirmDelete(overlay) {
overlay.confirmType = "delete";
confirm(overlay);
}

View File

@@ -87,6 +87,33 @@
}
var removeAllEntries = function () {
localizationService.localizeMany(["content_nestedContentDeleteAllItems", "general_delete"]).then(function (data) {
overlayService.confirmDelete({
title: data[1],
content: data[0],
close: function () {
overlayService.close();
},
submit: function () {
vm.nodes = [];
setDirty();
updateModel();
overlayService.close();
}
});
});
}
var removeAllEntriesAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
labelTokens: [],
icon: 'trash',
method: removeAllEntries,
isDisabled: true
}
// helper to force the current form into the dirty state
function setDirty() {
@@ -535,12 +562,14 @@
function updatePropertyActionStates() {
copyAllEntriesAction.isDisabled = !model.value || model.value.length === 0;
removeAllEntriesAction.isDisabled = model.value.length === 0;
}
var propertyActions = [
copyAllEntriesAction
copyAllEntriesAction,
removeAllEntriesAction
];
this.$onInit = function () {