Initial PublishedContent service for niceUrl access

This commit is contained in:
perploug
2013-10-03 20:58:16 +02:00
parent a3d77b7e72
commit 9ee1584ede
3 changed files with 73 additions and 0 deletions

View File

@@ -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);

View File

@@ -5,6 +5,16 @@
width:66.6%;
}
.umb-editor-tiny {
width: 50px;
}
.umb-editor-small {
width: 90px;
}
.umb-modal .umb-editor {
width: 95%;
}

View 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);
}
}
}