set variants to pristine after saving

This commit is contained in:
Shannon
2018-08-17 01:04:15 +10:00
parent 5324e0fc59
commit f9300b4714

View File

@@ -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;
}