Fixes: U4-3001 missing root node in tree selectors

This commit is contained in:
perploug
2013-10-01 15:36:42 +02:00
parent e64eb05dcd
commit e1c0e70d07
5 changed files with 22 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ angular.module("umbraco.directives")
if(!hideheader){
template +='<div>' +
'<h5><a href="#{{section}}" class="root-link">{{tree.name}}</a></h5>' +
'<h5><a href="#{{section}}" ng-click="select(this, tree.root, $event)" class="root-link">{{tree.name}}</a></h5>' +
'<a href class="umb-options" ng-hide="tree.root.isContainer || !tree.root.menuUrl" ng-click="options(this, tree.root, $event)" ng-swipe-right="options(this, tree.root, $event)"><i></i><i></i><i></i></a>' +
'</div>';
}
@@ -56,7 +56,6 @@ angular.module("umbraco.directives")
/** Helper function to emit tree events */
function emitEvent(eventName, args) {
if (scope.eventhandler) {
$(scope.eventhandler).trigger(eventName, args);
}
@@ -109,6 +108,17 @@ angular.module("umbraco.directives")
emitEvent("treeOptionsClick", { element: e, node: n, event: ev });
};
/**
Method called when an item is clicked in the tree, this passes the
DOM element, the tree node object and the original click
and emits it as a treeNodeSelect element if there is a callback object
defined on the tree
*/
scope.select = function(e,n,ev){
emitEvent("treeNodeSelect", { element: e, node: n, event: ev });
};
//watch for section changes
scope.$watch("section", function (newVal, oldVal) {

View File

@@ -47,11 +47,9 @@ angular.module("umbraco.directives")
/** Helper function to emit tree events */
function emitEvent(eventName, args) {
if(scope.eventhandler){
$(scope.eventhandler).trigger(eventName,args);
}
//$rootScope.$broadcast(eventName, args);
}
/**

View File

@@ -44,9 +44,15 @@
background: #2e8aea;
border-color: #2e8aea;
}
.umb-tree li.root div {
padding-left: 20px
.umb-tree li.root > div {
padding-left: 20px;
}
.umb-tree li.root > div h5 {
margin-top: 10px;
}
.umb-tree * {
white-space: nowrap
}

View File

@@ -5,7 +5,7 @@
<umb-tree
section="content"
cachekey="contentpickerDialog"
showheader="false"
showheader="true"
showoptions="false"
eventhandler="dialogTreeEventHandler">
</umb-tree>

View File

@@ -5,7 +5,7 @@
<umb-tree
section="{{section}}"
cachekey="treepickerDialog"
showheader="false"
showheader="true"
showoptions="false"
eventhandler="dialogTreeEventHandler">
</umb-tree>