support for fetching a specific tree

This commit is contained in:
perploug
2013-10-10 08:51:46 +02:00
parent 79f7ea60f2
commit a2df4ea742
6 changed files with 36 additions and 16 deletions

View File

@@ -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;
});

View File

@@ -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);
},

View File

@@ -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){

View File

@@ -3,7 +3,8 @@
<div class="tab-content umb-control-group">
<div class="umb-pane">
<umb-tree
section="{{section}}"
section="{{section}}"
treealias="{{treeAlias}}"
cachekey="treepickerDialog"
showheader="true"
showoptions="false"