Fixes: U4-5578 MNTP with root node, recursive output

This commit is contained in:
Shannon
2014-10-07 11:51:11 +11:00
parent e1dcf6b061
commit b60e292d5f
2 changed files with 30 additions and 8 deletions

View File

@@ -1,4 +1,7 @@
//used for the media picker dialog
//TODO: SD: Pretty sure we don't want this anymore and we should just be using the treepicker.html instead for all tree picking.
//used for the content picker dialog
angular.module("umbraco").controller("Umbraco.Dialogs.ContentPickerController",
function ($scope, eventsService, entityResource, searchService, $log) {
var dialogOptions = $scope.dialogOptions;

View File

@@ -52,15 +52,8 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
if(dialogOptions.filter[0] === "{"){
dialogOptions.filterAdvanced = true;
}
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", function (ev, args) {
if (angular.isArray(args.children)) {
performFiltering(args.children);
}
});
}
/** Method used for selecting a node */
function select(text, id, entity) {
//if we get the root, we just return a constructed entity, no need for server data
@@ -199,4 +192,30 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
}
}
});
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", function (ev, args) {
//remove the custom startNodeId query string param, that is only meant to be used 1 time
// for the initial tree structure loading.
if (angular.isArray(args.children)) {
for (var child in args.children) {
var parts = args.children[child].childNodesUrl.split("&");
var childNodesUrl = "";
for (var p in parts) {
if (!parts[p].startsWith("startNodeId")) {
childNodesUrl += parts[p] + "&";
}
}
childNodesUrl = childNodesUrl.trimEnd("&");
args.children[child].childNodesUrl = childNodesUrl;
}
}
if (dialogOptions.filter) {
if (angular.isArray(args.children)) {
performFiltering(args.children);
}
}
});
});