Fix #3368 by watching changes and explicitly flagging the form as dirty

This commit is contained in:
Kenn Jacobsen
2018-10-21 12:39:20 +02:00
committed by Sebastiaan Janssen
parent cd6f489606
commit 10526cfc81

View File

@@ -9,7 +9,7 @@
(function () {
"use strict";
function DocumentTypesEditController($scope, $routeParams, $injector, contentTypeResource, dataTypeResource, editorState, contentEditingHelper, formHelper, navigationService, iconHelper, contentTypeHelper, notificationsService, $filter, $q, localizationService, overlayHelper, eventsService) {
function DocumentTypesEditController($scope, $routeParams, $injector, contentTypeResource, dataTypeResource, editorState, contentEditingHelper, formHelper, navigationService, iconHelper, contentTypeHelper, notificationsService, $filter, $q, localizationService, overlayHelper, eventsService, angularHelper) {
var vm = this;
var localizeSaving = localizationService.localize("general_saving");
@@ -375,6 +375,15 @@
eventsService.unsubscribe(evts[e]);
}
});
// #3368 - changes on the other "buttons" do not register on the current form, so we manually have to flag the form as dirty
$scope.$watch("vm.contentType.allowedContentTypes.length + vm.contentType.allowAsRoot + vm.contentType.allowedTemplates.length + vm.contentType.isContainer", function (newVal, oldVal) {
if (oldVal === undefined) {
// still initializing, ignore
return;
}
angularHelper.getCurrentForm($scope).$setDirty();
});
}
angular.module("umbraco").controller("Umbraco.Editors.DocumentTypes.EditController", DocumentTypesEditController);