update delete dialogs to handle empty names

This commit is contained in:
Mads Rasmussen
2021-08-12 11:36:07 +02:00
parent c93a572425
commit e3f75252a2
2 changed files with 41 additions and 25 deletions

View File

@@ -534,16 +534,20 @@
};
scope.removeTab = (tab, indexInTabs) => {
localizationService.localizeMany([
'general_delete',
'defaultdialogs_confirmdelete',
'contentTypeEditor_confirmDeleteTabNotice'
]).then(data => {
const tabName = tab.name || "";
const localizeMany = localizationService.localizeMany(['general_delete', 'contentTypeEditor_confirmDeleteTabNotice']);
const localize = localizationService.localize('contentTypeEditor_confirmDeleteTabMessage', [tabName]);
$q.all([localizeMany, localize]).then(values => {
const translations = values[0];
const message = values[1];
overlayService.confirmDelete({
title: data[0],
content: data[1] + ' "' + tab.name + '"?',
confirmMessage: data[2],
submitButtonLabelKey: 'contentTypeEditor_yesDelete',
title: `${translations[0]} ${tabName}`,
content: message,
confirmMessage: translations[1],
submitButtonLabelKey: 'actions_delete',
submit: () => {
const indexInGroups = scope.model.groups.findIndex(group => group.alias === tab.alias);
scope.model.groups.splice(indexInGroups, 1);
@@ -742,16 +746,20 @@
};
scope.removeGroup = (selectedGroup) => {
localizationService.localizeMany([
'general_delete',
'defaultdialogs_confirmdelete',
'contentTypeEditor_confirmDeleteGroupNotice'
]).then(data => {
const groupName = selectedGroup.name || "";
const localizeMany = localizationService.localizeMany(['general_delete', 'contentTypeEditor_confirmDeleteGroupNotice']);
const localize = localizationService.localize('contentTypeEditor_confirmDeleteGroupMessage', [groupName]);
$q.all([localizeMany, localize]).then(values => {
const translations = values[0];
const message = values[1];
overlayService.confirmDelete({
title: data[0],
content: data[1] + ' "' + selectedGroup.name + '"?',
confirmMessage: data[2],
submitButtonLabelKey: 'contentTypeEditor_yesDelete',
title: `${translations[0]} ${groupName}`,
content: message,
confirmMessage: translations[1],
submitButtonLabelKey: 'actions_delete',
submit: () => {
const index = scope.model.groups.findIndex(group => group.alias === selectedGroup.alias);
scope.model.groups.splice(index, 1);
@@ -940,14 +948,19 @@
};
scope.deleteProperty = (properties, { id, label }) => {
localizationService.localizeMany([
'general_delete',
'defaultdialogs_confirmdelete'
]).then(data => {
const propertyName = label || "";
const localizeMany = localizationService.localizeMany(['general_delete']);
const localize = localizationService.localize('contentTypeEditor_confirmDeletePropertyMessage', [propertyName]);
$q.all([localizeMany, localize]).then(values => {
const translations = values[0];
const message = values[1];
overlayService.confirmDelete({
title: data[0],
content: data[1] + ' "' + label + '"?',
submitButtonLabelKey: 'contentTypeEditor_yesDelete',
title: `${translations[0]} ${propertyName}`,
content: message,
submitButtonLabelKey: 'actions_delete',
submit: () => {
const index = properties.findIndex(property => property.id === id);
properties.splice(index, 1);

View File

@@ -1755,6 +1755,9 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="propertyHasChanges">You have made changes to this property. Are you sure you want to discard them?</key>
<key alias="displaySettingsHeadline">Appearance</key>
<key alias="displaySettingsLabelOnTop">Label above (full-width)</key>
<key alias="confirmDeleteTabMessage"><![CDATA[Are you sure you want to delete the tab <strong>%0%</strong>?]]></key>
<key alias="confirmDeleteGroupMessage"><![CDATA[Are you sure you want to delete the group <strong>%0%</strong>?]]></key>
<key alias="confirmDeletePropertyMessage"><![CDATA[Are you sure you want to delete the property <strong>%0%</strong>?]]></key>
<key alias="confirmDeleteTabNotice">This will also delete all items below this tab.</key>
<key alias="confirmDeleteGroupNotice">This will also delete all items below this group.</key>
<key alias="addTab">Add tab</key>