Adds support for xpath root node selection on mntp

This commit is contained in:
perploug
2014-01-24 18:38:39 +01:00
parent 8258619055
commit d842f0f5b7
3 changed files with 36 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
<div ng-controller="Umbraco.PrevalueEditors.TreeSourceController" class="umb-editor umb-contentpicker">
<select ng-model="model.value.type">
<select ng-model="model.value.type" class="umb-editor">
<option value="content">Content</option>
<option value="media">Media</option>
<option value="member">Members</option>
@@ -18,13 +18,37 @@
</li>
</ul>
<ul class="unstyled list-icons" ng-show="multipicker || !node">
<li ng-hide="showSearch">
<i class="icon icon-add blue"></i>
<a href ng-click="openContentPicker()" prevent-default>
<localize key="general_choose">Choose</localize>...
</a>
</li>
</ul>
<div ng-show="multipicker || !node">
<span ng-hide="showSearch || model.value.query">
<i class="icon icon-add blue"></i>
<a href ng-click="openContentPicker()" prevent-default>
<localize key="general_choose">Choose</localize>...
</a>
<br/>
<a href ng-click="showSearch = true">Enter query</a>
</span>
<span ng-show="showSearch || model.value.query">
<input type="text"
ng-model="model.value.query"
class="umb-editor umb-textstring"
placeholder="Enter query">
<br/>
<small>
Available placeholders: <br/>
<code>$current</code>: current page or closest found ancestor<br/>
<code>$parent</code>: parent page or closest found ancestor<br/>
<code>$root</code>: root of the content tree<br/>
<code>$site</code>: Ancestor node at level 1 <br/>
</small>
<a href ng-click="showSearch = false; model.value.query = ''; openContentPicker()"> ...Or pick a node</a>
</span>
</div>
</div>
</div>

View File

@@ -3,7 +3,7 @@
angular.module('umbraco')
.controller("Umbraco.PropertyEditors.ContentPickerController",
function($scope, dialogService, entityResource, editorState, $log, iconHelper){
function($scope, dialogService, entityResource, editorState, $log, iconHelper, $routeParams){
$scope.renderModel = [];
$scope.ids = $scope.model.value ? $scope.model.value.split(',') : [];
@@ -14,6 +14,7 @@ angular.module('umbraco')
filterCssClass: "not-allowed not-published",
startNode:{
query: "",
type: "content",
id: -1
}
@@ -35,11 +36,7 @@ angular.module('umbraco')
//if we have a query for the startnode, we will use that.
if($scope.cfg.startNode.query){
var rootId = -1;
if($scope.cfg.startNode.scope === "current"){
rootId = editorState.current.id;
}
var rootId = $routeParams.id;
entityResource.getByQuery($scope.cfg.startNode.query, rootId, "Document").then(function(ent){
$scope.cfg.startNodeId = ent.id;
});

View File

@@ -23,5 +23,4 @@
</a>
</li>
</ul>
</div>