diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js
index c85a85bb57..9453ca8c41 100644
--- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js
+++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js
@@ -172,7 +172,7 @@ function entityResource($q, $http, umbRequestHelper) {
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetUrlAndAnchors",
- { id: id })),
+ [{ id: id }])),
'Failed to retrieve url and anchors data for id ' + id);
},
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js
index 2b6b77ed41..d9f907eacc 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js
@@ -28,24 +28,23 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
if (dialogOptions.currentTarget) {
// clone the current target so we don't accidentally update the caller's model while manipulating $scope.model.target
$scope.model.target = angular.copy(dialogOptions.currentTarget);
- //if we have a node ID, we fetch the current node to build the form data
+ // if we have a node ID, we fetch the current node to build the form data
if ($scope.model.target.id || $scope.model.target.udi) {
- //will be either a udi or an int
+ // will be either a udi or an int
var id = $scope.model.target.udi ? $scope.model.target.udi : $scope.model.target.id;
// is it a content link?
if (!$scope.model.target.isMedia) {
// get the content path
entityResource.getPath(id, "Document").then(function (path) {
- //now sync the tree to this path
+ // now sync the tree to this path
$scope.dialogTreeEventHandler.syncTree({
path: path,
tree: "content"
});
});
-
entityResource.getUrlAndAnchors(id).then(function(resp){
$scope.anchorValues = resp.anchorValues;
$scope.model.target.url = resp.url;
diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index 85d5b607b6..ada0206545 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -56,6 +56,7 @@ namespace Umbraco.Web.Editors
//id is passed in eventually we'll probably want to support GUID + Udi too
new ParameterSwapControllerActionSelector.ParameterSwapInfo("GetPagedChildren", "id", typeof(int), typeof(string)),
new ParameterSwapControllerActionSelector.ParameterSwapInfo("GetPath", "id", typeof(int), typeof(Guid), typeof(Udi)),
+ new ParameterSwapControllerActionSelector.ParameterSwapInfo("GetUrlAndAnchors", "id", typeof(int), typeof(Guid), typeof(Udi)),
new ParameterSwapControllerActionSelector.ParameterSwapInfo("GetById", "id", typeof(int), typeof(Guid), typeof(Udi)),
new ParameterSwapControllerActionSelector.ParameterSwapInfo("GetByIds", "ids", typeof(int[]), typeof(Guid[]), typeof(Udi[]))));
}
@@ -281,9 +282,17 @@ namespace Umbraco.Web.Editors
publishedContentExists: i => Umbraco.TypedContent(i) != null);
}
+ [HttpGet]
+ public UrlAndAnchors GetUrlAndAnchors(Udi id)
+ {
+ var nodeId = Umbraco.GetIdForUdi(id);
+ var url = Umbraco.Url(nodeId);
+ var anchorValues = Services.ContentService.GetAnchorValuesFromRTEs(nodeId);
+ return new UrlAndAnchors(url, anchorValues);
+ }
[HttpGet]
- public UrlAndAnchors GetUrlAndAnchors([FromUri]int id)
+ public UrlAndAnchors GetUrlAndAnchors(int id)
{
var url = Umbraco.Url(id);
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEs(id);
diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs
index c00d37f216..46ae098e2e 100644
--- a/src/Umbraco.Web/UmbracoHelper.cs
+++ b/src/Umbraco.Web/UmbracoHelper.cs
@@ -492,6 +492,18 @@ namespace Umbraco.Web
return Url(nodeId);
}
+ ///
+ /// Returns a string with a friendly url from a node.
+ /// IE.: Instead of having /482 (id) as an url, you can have
+ /// /screenshots/developer/macros (spoken url)
+ ///
+ /// Identifier for the node that should be returned
+ /// String with a friendly url from a node
+ public string NiceUrl(Guid guid)
+ {
+ return Url(guid);
+ }
+
///
/// Gets the url of a content identified by its identifier.
///
@@ -502,6 +514,16 @@ namespace Umbraco.Web
return UrlProvider.GetUrl(contentId);
}
+ ///
+ /// Gets the url of a content identified by its identifier.
+ ///
+ /// The content identifier.
+ /// The url for the content.
+ public string Url(Guid contentGuid)
+ {
+ return UrlProvider.GetUrl(contentGuid);
+ }
+
///
/// Gets the url of a content identified by its identifier, in a specified mode.
///
@@ -513,6 +535,17 @@ namespace Umbraco.Web
return UrlProvider.GetUrl(contentId, mode);
}
+ ///
+ /// Gets the url of a content identified by its identifier, in a specified mode.
+ ///
+ /// The content identifier.
+ /// The mode.
+ /// The url for the content.
+ public string Url(Guid contentGuid, UrlProviderMode mode)
+ {
+ return UrlProvider.GetUrl(contentGuid, mode);
+ }
+
///
/// This method will always add the domain to the path if the hostnames are set up correctly.
///