diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js index f265292389..e3023e2170 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js @@ -11,12 +11,8 @@ vm.$onInit = onInit; - vm.removePromptIsVisible = false; - vm.updateName = updateName; vm.removeGroup = removeGroup; - vm.togglePrompt = togglePrompt; - vm.hidePrompt = hidePrompt; vm.whenNameFocus = whenNameFocus; vm.whenFocus = whenFocus; vm.changeSortOrderValue = changeSortOrderValue; @@ -28,14 +24,6 @@ vm.formName = `groupForm${identifier}`; } - function togglePrompt () { - vm.removePromptIsVisible = !vm.removePromptIsVisible; - } - - function hidePrompt () { - vm.removePromptIsVisible = false; - } - function updateName (group) { if (vm.onUpdateName) { vm.onUpdateName({ group }); @@ -45,7 +33,6 @@ function removeGroup () { if (vm.onRemove) { vm.onRemove({ group: vm.group }); - vm.removePromptIsVisible = false; } } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js index 2e70656d56..12b6074dc0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js @@ -9,11 +9,7 @@ const vm = this; - vm.removePromptIsVisible = false; - vm.edit = edit; - vm.togglePrompt = togglePrompt; - vm.hidePrompt = hidePrompt; vm.remove = remove; vm.changeSortOrderValue = changeSortOrderValue; @@ -23,18 +19,9 @@ } } - function togglePrompt () { - vm.removePromptIsVisible = !vm.removePromptIsVisible; - } - - function hidePrompt () { - vm.removePromptIsVisible = false; - } - function remove () { if (vm.onRemove) { vm.onRemove({ property: vm.property }); - vm.removePromptIsVisible = false; } } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypetab.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypetab.component.js index e9bcbe5759..5866e9d0d3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypetab.component.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypetab.component.js @@ -5,29 +5,17 @@ * A component to render the content type tab */ - function umbContentTypeTabController(editorService) { + function umbContentTypeTabController() { const vm = this; - vm.removePromptIsVisible = false; - vm.click = click; vm.removeTab = removeTab; - vm.togglePrompt = togglePrompt; - vm.hidePrompt = hidePrompt; vm.whenFocusName = whenFocusName; vm.whenFocus = whenFocus; vm.changeSortOrderValue = changeSortOrderValue; vm.changeName = changeName; - function togglePrompt () { - vm.removePromptIsVisible = !vm.removePromptIsVisible; - } - - function hidePrompt () { - vm.removePromptIsVisible = false; - } - function click () { if (vm.onClick) { vm.onClick({ tab: vm.tab }); @@ -37,7 +25,6 @@ function removeTab () { if (vm.onRemove) { vm.onRemove({ tab: vm.tab }); - vm.removePromptIsVisible = false; } } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js index b74720624e..d2bc3e9b21 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js @@ -426,17 +426,40 @@ }; scope.removeTab = function (tab, indexInTabs) { - scope.model.groups.splice(tab.indexInGroups, 1); + $q.all([ + localizationService.localize('contentTypeEditor_removeTabPromptTitle', [tab.name]), + localizationService.localize('contentTypeEditor_removeTabPromptContent', [tab.name]) + ]).then((localizations) => { - // remove all child groups - scope.model.groups = scope.model.groups.filter(group => group.parentKey !== tab.key); + const confirm = { + title: localizations[0], + view: "default", + content: localizations[1], + submitButtonLabelKey: "general_remove", + submitButtonStyle: "danger", + closeButtonLabelKey: "general_cancel", + submit: function () { + scope.model.groups.splice(tab.indexInGroups, 1); + + // remove all child groups + scope.model.groups = scope.model.groups.filter(group => group.parentKey !== tab.key); + + // we need a timeout because the filter hasn't updated the tabs collection + $timeout(() => { + scope.openTabKey = indexInTabs > 0 ? scope.tabs[indexInTabs - 1].key : scope.tabs[0].key; + }); + + scope.$broadcast('umbOverflowChecker.checkOverflow'); - // we need a timeout because the filter hasn't updated the tabs collection - $timeout(() => { - scope.openTabKey = indexInTabs > 0 ? scope.tabs[indexInTabs - 1].key : scope.tabs[0].key; + overlayService.close(); + }, + close: function () { + overlayService.close(); + } + }; + + overlayService.open(confirm); }); - - scope.$broadcast('umbOverflowChecker.checkOverflow'); }; scope.canRemoveTab = function (tab) { @@ -451,10 +474,6 @@ scope.tabs = $filter('orderBy')(scope.tabs, 'sortOrder'); }; - scope.onChangeTabIcon = function (icon, color, tab) { - tab.icon = color ? icon + ' ' + color : icon; - }; - scope.onChangeTabName = function () { scope.$broadcast('umbOverflowChecker.checkOverflow'); }; @@ -562,9 +581,33 @@ return group.inherited !== true && _.find(group.properties, function (property) { return property.locked === true; }) == null; }; - scope.removeGroup = function (key) { - const index = scope.model.groups.findIndex(group => group.key === key); - scope.model.groups.splice(index, 1); + scope.removeGroup = function (selectedGroup) { + $q.all([ + localizationService.localize('contentTypeEditor_removeGroupPromptTitle', [selectedGroup.name]), + localizationService.localize('contentTypeEditor_removeGroupPromptContent', [selectedGroup.name]) + ]).then((localizations) => { + + const confirm = { + title: localizations[0], + view: "default", + content: localizations[1], + submitButtonLabelKey: "general_remove", + submitButtonStyle: "danger", + closeButtonLabelKey: "general_cancel", + submit: function () { + + const index = scope.model.groups.findIndex(group => group.key === selectedGroup.key); + scope.model.groups.splice(index, 1); + + overlayService.close(); + }, + close: function () { + overlayService.close(); + } + }; + + overlayService.open(confirm); + }); }; scope.addGroupToActiveTab = function () { @@ -725,10 +768,35 @@ } }; - scope.deleteProperty = function (properties, { id }) { - const index = properties.map(property => property.id).findIndex(propertyId => propertyId === id); - properties.splice(index, 1); - notifyChanged(); + scope.deleteProperty = function (properties, { id, label }) { + + $q.all([ + localizationService.localize('contentTypeEditor_removePropertyPromptTitle', [label]), + localizationService.localize('contentTypeEditor_removePropertyPromptContent', [label]) + ]).then((localizations) => { + + const confirm = { + title: localizations[0], + view: "default", + content: localizations[1], + submitButtonLabelKey: "general_remove", + submitButtonStyle: "danger", + closeButtonLabelKey: "general_cancel", + submit: function () { + + const index = properties.findIndex(property => property.id === id); + properties.splice(index, 1); + notifyChanged(); + + overlayService.close(); + }, + close: function () { + overlayService.close(); + } + }; + + overlayService.open(confirm); + }); }; scope.onChangePropertySortOrderValue = function (group) { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html index 12be86e061..9c7f78ce4f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html @@ -50,13 +50,7 @@
- - - +
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html index d8d3418272..4834cbd557 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html @@ -137,15 +137,9 @@
- - -
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-tab.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-tab.html index ddbb381f20..5a54e0f71e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-tab.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-tab.html @@ -51,14 +51,8 @@
- - -
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html index 1d72e78485..e2700112eb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html @@ -19,7 +19,6 @@ on-remove="removeTab(tab, tabIndex)" val-server-field-name="{{'Groups[' + tab.indexInGroups + '].Name'}}" on-change-sort-order-value="onChangeTabSortOrderValue(tab)" - on-change-icon="onChangeTabIcon(icon, color, tab)" on-change-name="onChangeTabName(name)"> @@ -116,7 +115,7 @@ allow-name="true" group="group" allow-remove="canRemoveGroup(group) && !sortingMode" - on-remove="removeGroup(group.key)" + on-remove="removeGroup(group)" sorting="sortingMode" val-server-field-name="{{'Groups[' + $index + '].Name'}}" on-change-sort-order-value="onChangeGroupSortOrderValue(group)"> diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 61169b120e..6d6ba0cec3 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1754,6 +1754,12 @@ To manage your website, simply open the Umbraco backoffice and start adding cont You have made changes to this property. Are you sure you want to discard them? Appearance Label above (full-width) + Remove the tab "%0%?" + Are you sure you want to remove "%0%" and all groups and properties underneath? + Remove the group "%0%?" + Are you sure you want to remove "%0%" and all properties underneath? + Remove the property "%0%"? + Are you sure you want to remove "%0%"? Add language