Update ElementType Resource to not use hardcoded URL but to use the Umbraco.Sys.ServerVariables.umbracoUrls instead
This commit is contained in:
@@ -8,21 +8,14 @@ function elementTypeResource($q, $http, umbRequestHelper) {
|
||||
return {
|
||||
|
||||
getAll: function () {
|
||||
|
||||
var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/UmbracoApi/ElementType/GetAll";
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(url),
|
||||
'Failed to retrieve element types'
|
||||
);
|
||||
|
||||
/*
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"elementTypeApiBaseUrl",
|
||||
"GetAll")),
|
||||
"Failed to retrieve data");
|
||||
*/
|
||||
"Failed to retrieve element types");
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -318,6 +318,10 @@ namespace Umbraco.Web.Editors
|
||||
"imageUrlGeneratorApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<ImageUrlGeneratorController>(
|
||||
controller => controller.GetCropUrl(null, null, null, null, null))
|
||||
},
|
||||
{
|
||||
"elementTypeApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<ElementTypeController>(
|
||||
controller => controller.GetAll())
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
@@ -9,7 +9,7 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class ElementTypeController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
[System.Web.Http.HttpGet]
|
||||
[HttpGet]
|
||||
public IEnumerable<object> GetAll()
|
||||
{
|
||||
return Services.ContentTypeService
|
||||
|
||||
Reference in New Issue
Block a user