diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index 02d1979863..4006ab8d51 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -13,12 +13,13 @@ angular.module("umbraco.directives") scope: { section: '@', + treealias: '@', + path: '@', activetree: '@', showoptions: '@', showheader: '@', cachekey: '@', - eventhandler: '=', - path: '@' + eventhandler: '=' }, compile: function (element, attrs) { @@ -73,14 +74,14 @@ angular.module("umbraco.directives") enableDeleteAnimations = false; //use $q.when because a promise OR raw data might be returned. - $q.when(treeService.getTree({ section: scope.section, cachekey: scope.cachekey })) + $q.when(treeService.getTree({ section: scope.section, tree: scope.treealias, cachekey: scope.cachekey })) .then(function (data) { //set the data once we have it - + scope.tree = data; //do timeout so that it re-enables them after this digest $timeout(function() { - scope.tree = data; + //enable delete animations enableDeleteAnimations = true; }); diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js index 66391893ea..9938012cc3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js @@ -39,12 +39,19 @@ function treeResource($q, $http, umbRequestHelper) { throw "The object specified for does not contain a 'section' property"; } + if(!options.tree){ + options.tree = ""; + } + return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "treeApplicationApiBaseUrl", "GetApplicationTrees", - [{ application: options.section }])), + [ + {application: options.section}, + {tree: options.tree} + ])), 'Failed to retreive data for application tree ' + options.section); }, diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js index 8a0c48a13e..5005d329b1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js @@ -4,6 +4,7 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController", var dialogOptions = $scope.$parent.dialogOptions; $scope.dialogTreeEventHandler = $({}); $scope.section = dialogOptions.section; + $scope.treeAlias = dialogOptions.treeAlias; $scope.dialogTreeEventHandler.bind("treeNodeSelect", function(ev, args){ diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html index 77fe01587a..205d8548cc 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html @@ -3,7 +3,8 @@
diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 5ef3fa0afe..4462bfb5fe 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -39,7 +39,7 @@ namespace Umbraco.Web.Trees /// /// [HttpQueryStringFilter("queryStrings")] - public SectionRootNode GetApplicationTrees(string application, FormDataCollection queryStrings) + public SectionRootNode GetApplicationTrees(string application, string tree, FormDataCollection queryStrings) { if (application == null) throw new ArgumentNullException("application"); @@ -47,24 +47,34 @@ namespace Umbraco.Web.Trees //find all tree definitions that have the current application alias var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, true).ToArray(); - if (appTrees.Count() == 1) + + if (appTrees.Count() == 1 || !string.IsNullOrEmpty(tree) ) { - var tree = GetRootForSingleAppTree( - appTrees.Single(), + ApplicationTree apptree; + + if (!string.IsNullOrEmpty(tree)) + apptree = appTrees.Where(x => x.Alias == tree).Single(); + else + apptree = appTrees.Single(); + + + var result = GetRootForSingleAppTree( + apptree, Constants.System.Root.ToString(CultureInfo.InvariantCulture), queryStrings, application); //PP: should this be further down in the logic? - tree.Title = ui.Text("sections", application); - return tree; + result.Title = ui.Text("sections", application); + return result; } + var collection = new TreeNodeCollection(); - foreach (var tree in appTrees) + foreach (var apptree in appTrees) { //return the root nodes for each tree in the app - var rootNode = GetRootForMultipleAppTree(tree, queryStrings); + var rootNode = GetRootForMultipleAppTree(apptree, queryStrings); collection.Add(rootNode); }