diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 8564cf2c43..22e10b0f92 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -4,7 +4,7 @@ function ContentEditController($rootScope, $scope, $routeParams, $q, $window, appState, contentResource, entityResource, navigationService, notificationsService, serverValidationManager, contentEditingHelper, treeService, formHelper, umbRequestHelper, - editorState, $http, eventsService, relationResource, overlayService) { + editorState, $http, eventsService, relationResource, overlayService, angularHelper) { var evts = []; var infiniteMode = $scope.infiniteModel && $scope.infiniteModel.infiniteMode; @@ -109,7 +109,7 @@ }); } })); - + } /** @@ -308,6 +308,19 @@ } } + function ensureDirtyIsSetIfAnyVariantIsDirty() { + var currentForm = angularHelper.getCurrentForm($scope); + + currentForm.$dirty = false; + + for (var i = 0; i < $scope.content.variants.length; i++) { + if($scope.content.variants[i].isDirty){ + currentForm.$dirty = true; + return; + } + } + } + // This is a helper method to reduce the amount of code repitition for actions: Save, Publish, SendToPublish function performSave(args) { @@ -331,6 +344,7 @@ eventsService.emit("content.saved", { content: $scope.content, action: args.action }); resetNestedFieldValiation(fieldsToRollback); + ensureDirtyIsSetIfAnyVariantIsDirty(); return $q.when(data); },