Merge remote-tracking branch 'origin/v10/dev' into v11/dev
This commit is contained in:
@@ -318,9 +318,22 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
'Failed to retrieve entity data for ids ' + ids);
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated use getByXPath instead.
|
||||
*/
|
||||
getByQuery: function (query, nodeContextId, type) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"entityApiBaseUrl",
|
||||
"GetByQuery",
|
||||
[{ query: query }, { nodeContextId: nodeContextId }, { type: type }])),
|
||||
'Failed to retrieve entity data for query ' + query);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.entityResource#getByQuery
|
||||
* @name umbraco.resources.entityResource#getByXPath
|
||||
* @methodOf umbraco.resources.entityResource
|
||||
*
|
||||
* @description
|
||||
@@ -329,7 +342,7 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
* ##usage
|
||||
* <pre>
|
||||
* //get content by xpath
|
||||
* entityResource.getByQuery("$current", -1, "Document")
|
||||
* entityResource.getByXPath("$current", -1, -1, "Document")
|
||||
* .then(function(ent) {
|
||||
* var myDoc = ent;
|
||||
* alert('its here!');
|
||||
@@ -338,17 +351,18 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
*
|
||||
* @param {string} query xpath to use in query
|
||||
* @param {Int} nodeContextId id id to start from
|
||||
* @param {Int} parentId id id of the parent to the starting point
|
||||
* @param {string} type Object type name
|
||||
* @returns {Promise} resourcePromise object containing the entity.
|
||||
*
|
||||
*/
|
||||
getByQuery: function (query, nodeContextId, type) {
|
||||
getByXPath: function (query, nodeContextId, parentId, type) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"entityApiBaseUrl",
|
||||
"GetByQuery",
|
||||
[{ query: query }, { nodeContextId: nodeContextId }, { type: type }])),
|
||||
"GetByXPath",
|
||||
[{ query: query }, { nodeContextId: nodeContextId }, { parentId: parentId }, { type: type }])),
|
||||
'Failed to retrieve entity data for query ' + query);
|
||||
},
|
||||
|
||||
|
||||
@@ -245,9 +245,12 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso
|
||||
dialogOptions.startNodeId = -1;
|
||||
}
|
||||
else if ($scope.model.config.startNode.query) {
|
||||
//if we have a query for the startnode, we will use that.
|
||||
var rootId = editorState.current.id;
|
||||
entityResource.getByQuery($scope.model.config.startNode.query, rootId, "Document").then(function (ent) {
|
||||
entityResource.getByXPath(
|
||||
$scope.model.config.startNode.query,
|
||||
editorState.current.id,
|
||||
editorState.current.parentId,
|
||||
"Document"
|
||||
).then(function (ent) {
|
||||
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user