diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js index 509e5ad01e..feecdac18c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js @@ -382,8 +382,8 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { * * ##usage *
-         * contentResource.getNiceUrl()
-         *    .then(function(stylesheets) {
+         * contentResource.getNiceUrl(id)
+         *    .then(function(url) {
          *        alert('its here!');
          *    });
          * 
@@ -401,6 +401,35 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { 'Failed to retrieve url for id:' + id); }, + /** + * @ngdoc method + * @name umbraco.resources.contentResource#getPath + * @methodOf umbraco.resources.contentResource + * + * @description + * Returns a url, given a node ID + * + * ##usage + *
+         * contentResource.getPath(id)
+         *    .then(function(pathArray) {
+         *        alert('its here!');
+         *    });
+         * 
+ * + * @param {Int} id Id of node to return the public url to + * @returns {Promise} resourcePromise object containing the url. + * + */ + getPath: function (id) { + return umbRequestHelper.resourcePromise( + $http.get( + umbRequestHelper.getApiUrl( + "contentApiBaseUrl", + "GetPath",[{id: id}])), + 'Failed to retrieve path for id:' + id); + }, + /** * @ngdoc method * @name umbraco.resources.contentResource#getChildren diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 27b1333375..847f23aef5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -622,7 +622,9 @@ 404handlers.config - + + Designer + ClientDependency.config diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index e6730cc227..c5a955da17 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -120,6 +120,22 @@ namespace Umbraco.Web.Editors return url; } + /// + /// Gets the path for a given node ID + /// + /// + /// + public IEnumerable GetPath(int id) + { + var foundContent = GetEntityFromRequest(() => Services.ContentService.GetById(id)); + if (foundContent == null) + { + HandleContentNotFound(id); + } + + return foundContent.Path.Split(',').Select(x => int.Parse(x)); + } + /// /// Gets the children for the content id passed in ///