From f9300b4714dd40c19d7f8d043b1bf485691ff744 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 17 Aug 2018 01:04:15 +1000 Subject: [PATCH] set variants to pristine after saving --- .../components/content/edit.controller.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 d3d2153887..171fec88e5 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 @@ -58,7 +58,7 @@ setActiveCulture(); - resetSaveAndPublishFlags(); + resetVariantFlags(); } /** This is called when the split view changes based on the umb-variant-content */ @@ -66,19 +66,27 @@ //send an event downwards $scope.$broadcast("editors.content.splitViewChanged", { editors: $scope.editors }); } - - /** When working with multiple variants, this will set the save/publish flags of each one to false. - * When working with a single variant, this will set the publish flag to false and the save flag to true. + + /** + * This will reset isDirty flags if save is true. + * When working with multiple variants, this will set the save/publish flags of each one to false. + * When working with a single variant, this will set the publish flag to false and the save flag to true. */ - function resetSaveAndPublishFlags() { + function resetVariantFlags() { if ($scope.content.variants.length > 1) { for (var i = 0; i < $scope.content.variants.length; i++) { var v = $scope.content.variants[i]; + if (v.save) { + v.isDirty = false; + } v.save = false; v.publish = false; } } else { + if ($scope.content.variants[0].save) { + $scope.content.variants[0].isDirty = false; + } $scope.content.variants[0].save = true; $scope.content.variants[0].publish = false; }