From 956252f82da46adfd96f5edf7d3b2a39a6bb55f2 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 28 May 2020 07:50:56 +0200 Subject: [PATCH] https://dev.azure.com/umbraco/D-Team%20Tracker/_workitems/edit/6587 - Moved StylesheetController --- .../Controllers}/StylesheetController.cs | 19 ++++++++++++++----- .../Editors/BackOfficeServerVariables.cs | 8 ++++---- src/Umbraco.Web/Umbraco.Web.csproj | 1 - 3 files changed, 18 insertions(+), 10 deletions(-) rename src/{Umbraco.Web/Editors => Umbraco.Web.BackOffice/Controllers}/StylesheetController.cs (66%) diff --git a/src/Umbraco.Web/Editors/StylesheetController.cs b/src/Umbraco.Web.BackOffice/Controllers/StylesheetController.cs similarity index 66% rename from src/Umbraco.Web/Editors/StylesheetController.cs rename to src/Umbraco.Web.BackOffice/Controllers/StylesheetController.cs index 9785644d3f..852bff28c1 100644 --- a/src/Umbraco.Web/Editors/StylesheetController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/StylesheetController.cs @@ -1,10 +1,12 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Core; +using Umbraco.Core.Services; +using Umbraco.Web.Common.Attributes; +using Umbraco.Web.Editors; using Umbraco.Web.Models.ContentEditing; -using Umbraco.Web.Mvc; -namespace Umbraco.Web.Editors +namespace Umbraco.Web.BackOffice.Controllers { /// /// The API controller used for retrieving available stylesheets @@ -12,9 +14,16 @@ namespace Umbraco.Web.Editors [PluginController("UmbracoApi")] public class StylesheetController : UmbracoAuthorizedJsonController { + private readonly IFileService _fileService; + + public StylesheetController(IFileService fileService) + { + _fileService = fileService; + } + public IEnumerable GetAll() { - return Services.FileService.GetStylesheets() + return _fileService.GetStylesheets() .Select(x => new Stylesheet() { Name = x.Alias, @@ -24,7 +33,7 @@ namespace Umbraco.Web.Editors public IEnumerable GetRulesByName(string name) { - var css = Services.FileService.GetStylesheetByName(name.EnsureEndsWith(".css")); + var css = _fileService.GetStylesheetByName(name.EnsureEndsWith(".css")); if (css == null) return Enumerable.Empty(); @@ -32,4 +41,4 @@ namespace Umbraco.Web.Editors } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 5ecb37bc48..05aa602533 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -241,10 +241,10 @@ namespace Umbraco.Web.Editors // "rteApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( // controller => controller.GetConfiguration()) // }, - { - "stylesheetApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( - controller => controller.GetAll()) - }, + // { + // "stylesheetApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( + // controller => controller.GetAll()) + // }, { "memberTypeApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( controller => controller.GetAllTypes()) diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 9f917ca753..e0b901712e 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -345,7 +345,6 @@ -