Move and copy dialog treee sync

This commit is contained in:
perploug
2013-11-01 09:28:26 +01:00
parent 31c7af1737
commit e671300dc0
5 changed files with 27 additions and 12 deletions

View File

@@ -286,6 +286,12 @@ angular.module('umbraco.services')
}
},
reloadNode: function (node) {
if(this.ui.treeEventHandler){
this.ui.treeEventHandler.reloadNode(node);
}
},
reloadSection: function (sectionAlias) {
if(this.ui.treeEventHandler){
this.ui.treeEventHandler.clearCache(sectionAlias);

View File

@@ -1,6 +1,6 @@
angular.module("umbraco")
.controller("Umbraco.Editors.Content.CopyController",
function ($scope, eventsService, contentResource, $log) {
function ($scope, eventsService, contentResource, navigationService, $log) {
var dialogOptions = $scope.$parent.dialogOptions;
$scope.dialogTreeEventHandler = $({});
@@ -18,7 +18,7 @@ angular.module("umbraco")
}
c.find("i.umb-tree-icon").hide()
.after("<i class='icon umb-tree-icon sprTree icon-check blue temporary'></i>");
.after("<i class='icon umb-tree-icon sprTree icon-check blue temporary'></i>");
$scope.target = args.node;
$scope.selectedEl = c;
@@ -27,9 +27,12 @@ angular.module("umbraco")
$scope.copy = function(){
contentResource.copy({parentId: $scope.target.id, id: node.id, relateToOriginal: $scope.relate})
.then(function(){
.then(function(path){
$scope.error = false;
$scope.success = true;
navigationService.syncPath(path, true);
},function(err){
$scope.success = false;
$scope.error = err;

View File

@@ -1,6 +1,6 @@
//used for the media picker dialog
angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
function ($scope, eventsService, contentResource, $log) {
function ($scope, eventsService, contentResource, navigationService, $log) {
var dialogOptions = $scope.$parent.dialogOptions;
$scope.dialogTreeEventHandler = $({});
@@ -27,9 +27,15 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
$scope.move = function(){
contentResource.move({parentId: $scope.target.id, id: node.id})
.then(function(){
.then(function(path){
$scope.error = false;
$scope.success = true;
//reloads the parent
navigationService.reloadNode(dialogOptions.currentNode.parent);
//reloads the target
navigationService.syncPath(path, true);
},function(err){
$scope.success = false;
$scope.error = err;

View File

@@ -101,6 +101,8 @@ function DataTypeEditController($scope, $routeParams, $location, dataTypeResourc
}
});
navigationService.syncPath([String(data.id)]);
}, function(err) {
//NOTE: in the case of data type values we are setting the orig/new props