Initial PublishedContent service for niceUrl access
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name umbraco.resources.publishedContentResource
|
||||
* @description service to retrieve published content from the umbraco cache
|
||||
*
|
||||
*
|
||||
**/
|
||||
function publishedContentResource($q, $http, umbRequestHelper) {
|
||||
|
||||
//the factory object returned
|
||||
return {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.publishedContentResource#getUrl
|
||||
* @methodOf umbraco.resources.publishedContentResource
|
||||
*
|
||||
* @description
|
||||
* Returns a url, given a node ID
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* publishedContentResource.getUrl()
|
||||
* .then(function(stylesheets) {
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id Id of node to return the public url to
|
||||
* @returns {Promise} resourcePromise object containing the url.
|
||||
*
|
||||
*/
|
||||
getUrl: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"publishedContentApiBaseUrl",
|
||||
"GetUrl",[{id: id}])),
|
||||
'Failed to retreive url for id:' + id);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.resources').factory('publishedContentResource', publishedContentResource);
|
||||
@@ -5,6 +5,16 @@
|
||||
width:66.6%;
|
||||
}
|
||||
|
||||
.umb-editor-tiny {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.umb-editor-small {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.umb-modal .umb-editor {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
19
src/Umbraco.Web/Editors/PublishedContentController.cs
Normal file
19
src/Umbraco.Web/Editors/PublishedContentController.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
[PluginController("UmbracoApi")]
|
||||
public class PublishedContentController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);
|
||||
public string GetNiceUrl(int id)
|
||||
{
|
||||
return helper.NiceUrl(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user