Fixes: U4-7251 When changing a data type name to be the same as another we suffix the duplication with a number - this needs to be reflected in the UI

This commit is contained in:
Shannon
2015-10-14 16:54:58 +02:00
parent c0bd5f4d14
commit 85e46cbbe5
3 changed files with 33 additions and 7 deletions

View File

@@ -24,6 +24,28 @@ function dataTypeHelper() {
return preValues;
},
rebindChangedProperties: function (origContent, savedContent) {
//a method to ignore built-in prop changes
var shouldIgnore = function (propName) {
return _.some(["notifications", "ModelState"], function (i) {
return i === propName;
});
};
//check for changed built-in properties of the content
for (var o in origContent) {
//ignore the ones listed in the array
if (shouldIgnore(o)) {
continue;
}
if (!_.isEqual(origContent[o], savedContent[o])) {
origContent[o] = savedContent[o];
}
}
}
};

View File

@@ -6,7 +6,7 @@
* @description
* The controller for the content editor
*/
function DataTypeEditController($scope, $routeParams, $location, appState, navigationService, treeService, dataTypeResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, formHelper, editorState) {
function DataTypeEditController($scope, $routeParams, $location, appState, navigationService, treeService, dataTypeResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, formHelper, editorState, dataTypeHelper) {
//setup scope vars
$scope.page = {};
@@ -158,6 +158,8 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
$scope.page.saveButtonState = "success";
dataTypeHelper.rebindChangedProperties($scope.content, data);
}, function(err) {
//NOTE: in the case of data type values we are setting the orig/new props
@@ -171,6 +173,8 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
//share state
editorState.set($scope.content);
dataTypeHelper.rebindChangedProperties($scope.content, data);
});
}