V8: Use a standard confirm dialog when removing content type compositions (#6213)

This commit is contained in:
Kenn Jacobsen
2019-08-29 13:51:55 +02:00
committed by Sebastiaan Janssen
parent dfe96dccde
commit ad978c60df
4 changed files with 27 additions and 26 deletions

View File

@@ -376,14 +376,3 @@ a.umb-variant-switcher__toggle {
margin-right: auto;
padding-right: 10px;
}
/* Confirm */
.umb-editor-confirm {
background-color: @white;
padding: 20px;
position: absolute;
left: 0;
bottom: 0;
z-index: 10;
box-shadow: 0 -3px 12px 0px rgba(0,0,0,0.16);
}

View File

@@ -1,7 +1,7 @@
(function () {
"use strict";
function CompositionsController($scope, $location, $filter) {
function CompositionsController($scope, $location, $filter, overlayService) {
var vm = this;
var oldModel = null;
@@ -56,19 +56,35 @@
if ($scope.model && $scope.model.submit) {
// check if any compositions has been removed
vm.compositionRemoved = false;
var compositionRemoved = false;
for (var i = 0; oldModel.compositeContentTypes.length > i; i++) {
var oldComposition = oldModel.compositeContentTypes[i];
if (_.contains($scope.model.compositeContentTypes, oldComposition) === false) {
vm.compositionRemoved = true;
compositionRemoved = true;
}
}
/* submit the form if there havne't been removed any composition
or the confirm checkbox has been checked */
if (!vm.compositionRemoved || vm.allowSubmit) {
$scope.model.submit($scope.model);
if (compositionRemoved) {
vm.allowSubmit = false;
const dialog = {
view: "views/common/infiniteeditors/compositions/overlays/confirmremove.html",
submitButtonLabelKey: "general_ok",
closeButtonLabelKey: "general_cancel",
submit: function (model) {
$scope.model.submit($scope.model);
overlayService.close();
},
close: function () {
overlayService.close();
}
};
overlayService.open(dialog);
return;
}
$scope.model.submit($scope.model);
}
}

View File

@@ -92,16 +92,6 @@
</umb-box-content>
</umb-box>
<div ng-if="vm.compositionRemoved" class="umb-editor-confirm">
<h5 class="red"><i class="icon-alert"></i>Warning</h5>
<p>Removing a composition will delete all the associated property data. Once you save the document type there's no way back, are you sure?</p>
<label class="checkbox no-indent">
<input type="checkbox" ng-model="vm.allowSubmit" />
<strong>I know what I'm doing</strong>
</label>
</div>
</umb-editor-container>
<umb-editor-footer>

View File

@@ -0,0 +1,6 @@
<div>
<h5 class="red"><i class="icon-alert"></i>Warning</h5>
<p>Removing a composition will delete all the associated property data. Once you save the document type there's no way back, are you sure?</p>
</div>