tree syncing

This commit is contained in:
perploug
2013-10-07 10:09:03 +02:00
parent f676ce6ac2
commit ec4eeb5de6
5 changed files with 26 additions and 9 deletions

View File

@@ -123,8 +123,7 @@ angular.module("umbraco.directives")
//watch for section changes
scope.$watch("section", function (newVal, oldVal) {
if(!scope.tree){
if(!scope.tree){
loadTree();
}
@@ -141,6 +140,18 @@ angular.module("umbraco.directives")
}
});
//watch for path changes
scope.$watch("path", function (newVal, oldVal) {
if(!scope.tree){
loadTree();
}
if (newVal && newVal !== oldVal) {
//only reload the tree data and Dom if the newval is different from the old one
loadTree();
}
});
//watch for active tree changes
scope.$watch("activetree", function (newVal, oldVal) {

View File

@@ -6,7 +6,7 @@
* @description
* The controller for the content editor
*/
function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
//initialize the file manager
fileManager.clearFiles();
@@ -49,6 +49,8 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
newContent: data,
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
navigationService.syncPath(data.path.split(","));
});
};
@@ -73,6 +75,8 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
navigationService.syncPath(data.path.split(","));
}, function (err) {
contentEditingHelper.handleSaveError({
@@ -124,8 +128,9 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
deferred.resolve(data);
navigationService.syncPath(data.path.split(","));
deferred.resolve(data);
}, function (err) {
contentEditingHelper.handleSaveError({
err: err,