From 40e986d5dc5b462bfecabe2a567f5a4eebfa484c Mon Sep 17 00:00:00 2001 From: Shannon Date: Sun, 20 May 2018 15:56:40 +0200 Subject: [PATCH] Adds grid.resource --- .../src/common/resources/grid.resource.js | 20 +++++++++++++++++++ .../Editors/BackOfficeServerVariables.cs | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/common/resources/grid.resource.js diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/grid.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/grid.resource.js new file mode 100644 index 0000000000..781fba649f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/resources/grid.resource.js @@ -0,0 +1,20 @@ +/** + * @ngdoc service + * @name umbraco.resources.gridResource + * @description Handles retrieving grid data + **/ +function gridResource($http, umbRequestHelper) { + return { + + getCultures: function () { + return umbRequestHelper.resourcePromise( + $http.get( + umbRequestHelper.getApiUrl( + "gridApiBaseUrl", + "GetContentTypes")), + "Failed to get grid content types"); + } + }; +} + +angular.module('umbraco.resources').factory('gridResource', gridResource); diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 870bb4f3f7..d318034b99 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -292,6 +292,10 @@ namespace Umbraco.Web.Editors { "languageApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( controller => controller.GetAllLanguages()) + }, + { + "gridApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( + controller => controller.GetContentTypes()) } } },