support for fetching a specific tree
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user