Expand tree to current node on copy/move and when picking content
This commit is contained in:
@@ -20,16 +20,16 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
selectedSearchResults: []
|
||||
}
|
||||
|
||||
$scope.model.selection = [];
|
||||
|
||||
//Used for toggling an empty-state message
|
||||
$scope.model.selection = [];
|
||||
|
||||
//Used for toggling an empty-state message
|
||||
//Some trees can have no items (dictionary & forms email templates)
|
||||
$scope.hasItems = true;
|
||||
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
|
||||
|
||||
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
|
||||
var node = dialogOptions.currentNode;
|
||||
|
||||
//This is called from ng-init
|
||||
//it turns out it is called from the angular html : / Have a look at views/common / overlays / contentpicker / contentpicker.html you'll see ng-init.
|
||||
//This is called from ng-init
|
||||
//it turns out it is called from the angular html : / Have a look at views/common / overlays / contentpicker / contentpicker.html you'll see ng-init.
|
||||
//this is probably an anti pattern IMO and shouldn't be used
|
||||
$scope.init = function (contentType) {
|
||||
|
||||
@@ -157,10 +157,15 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
|
||||
//gets the tree object when it loads
|
||||
function treeLoadedHandler(ev, args) {
|
||||
//args.tree contains children (args.tree.root.children)
|
||||
$scope.hasItems = args.tree.root.children.length > 0;
|
||||
//args.tree contains children (args.tree.root.children)
|
||||
$scope.hasItems = args.tree.root.children.length > 0;
|
||||
|
||||
tree = args.tree;
|
||||
|
||||
if (node && node.path) {
|
||||
$scope.dialogTreeEventHandler.syncTree({ path: node.path, activate: false });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//wires up selection
|
||||
@@ -215,7 +220,7 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
icon: "icon-folder",
|
||||
id: id,
|
||||
name: text
|
||||
};
|
||||
};
|
||||
|
||||
if ($scope.multiPicker) {
|
||||
if (entity) {
|
||||
|
||||
@@ -27,6 +27,12 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.CopyController",
|
||||
|
||||
var node = dialogOptions.currentNode;
|
||||
|
||||
function treeLoadedHandler(ev, args) {
|
||||
if (node && node.path) {
|
||||
$scope.dialogTreeEventHandler.syncTree({ path: node.path, activate: false });
|
||||
}
|
||||
}
|
||||
|
||||
function nodeSelectHandler(ev, args) {
|
||||
|
||||
if(args && args.event) {
|
||||
@@ -110,10 +116,12 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.CopyController",
|
||||
});
|
||||
};
|
||||
|
||||
$scope.dialogTreeEventHandler.bind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler);
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.dialogTreeEventHandler.unbind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
|
||||
});
|
||||
@@ -131,5 +139,5 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.CopyController",
|
||||
function openMiniListView(node) {
|
||||
$scope.miniListView = node;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -25,6 +25,12 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
|
||||
|
||||
var node = dialogOptions.currentNode;
|
||||
|
||||
function treeLoadedHandler(ev, args) {
|
||||
if (node && node.path) {
|
||||
$scope.dialogTreeEventHandler.syncTree({ path: node.path, activate: false });
|
||||
}
|
||||
}
|
||||
|
||||
function nodeSelectHandler(ev, args) {
|
||||
|
||||
if(args && args.event) {
|
||||
@@ -111,10 +117,12 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
|
||||
});
|
||||
};
|
||||
|
||||
$scope.dialogTreeEventHandler.bind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler);
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.dialogTreeEventHandler.unbind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,12 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
|
||||
$scope.treeModel.hideHeader = userData.startMediaIds.length > 0 && userData.startMediaIds.indexOf(-1) == -1;
|
||||
});
|
||||
|
||||
function treeLoadedHandler(ev, args) {
|
||||
if (node && node.path) {
|
||||
$scope.dialogTreeEventHandler.syncTree({ path: node.path, activate: false });
|
||||
}
|
||||
}
|
||||
|
||||
function nodeSelectHandler(ev, args) {
|
||||
|
||||
if(args && args.event) {
|
||||
@@ -38,6 +44,7 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
|
||||
}
|
||||
}
|
||||
|
||||
$scope.dialogTreeEventHandler.bind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler);
|
||||
|
||||
@@ -71,6 +78,7 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.dialogTreeEventHandler.unbind("treeLoaded", treeLoadedHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
|
||||
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
|
||||
});
|
||||
|
||||
@@ -109,6 +109,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
entityType: entityType,
|
||||
filterCssClass: "not-allowed not-published",
|
||||
startNodeId: null,
|
||||
currentNode: editorState ? editorState.current : null,
|
||||
callback: function (data) {
|
||||
if (angular.isArray(data)) {
|
||||
_.each(data, function (item, i) {
|
||||
|
||||
@@ -243,6 +243,7 @@ namespace Umbraco.Web.Trees
|
||||
public TreeNode CreateTreeNode(UmbracoEntity entity, Guid entityObjectType, string parentId, FormDataCollection queryStrings, bool hasChildren)
|
||||
{
|
||||
var treeNode = CreateTreeNode(entity.Id.ToInvariantString(), parentId, queryStrings, entity.Name, entity.ContentTypeIcon);
|
||||
treeNode.Path = entity.Path;
|
||||
treeNode.Udi = Udi.Create(UmbracoObjectTypesExtensions.GetUdiType(entityObjectType), entity.Key);
|
||||
treeNode.HasChildren = hasChildren;
|
||||
return treeNode;
|
||||
@@ -261,6 +262,7 @@ namespace Umbraco.Web.Trees
|
||||
public TreeNode CreateTreeNode(IUmbracoEntity entity, Guid entityObjectType, string parentId, FormDataCollection queryStrings, string icon, bool hasChildren)
|
||||
{
|
||||
var treeNode = CreateTreeNode(entity.Id.ToInvariantString(), parentId, queryStrings, entity.Name, icon);
|
||||
treeNode.Path = entity.Path;
|
||||
treeNode.Udi = Udi.Create(UmbracoObjectTypesExtensions.GetUdiType(entityObjectType), entity.Key);
|
||||
treeNode.HasChildren = hasChildren;
|
||||
return treeNode;
|
||||
|
||||
Reference in New Issue
Block a user