This commit is contained in:
Bjarke Berg
2020-05-28 07:50:56 +02:00
parent 49923cef5e
commit 956252f82d
3 changed files with 18 additions and 10 deletions

View File

@@ -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
{
/// <summary>
/// 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<Stylesheet> 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<StylesheetRule> GetRulesByName(string name)
{
var css = Services.FileService.GetStylesheetByName(name.EnsureEndsWith(".css"));
var css = _fileService.GetStylesheetByName(name.EnsureEndsWith(".css"));
if (css == null)
return Enumerable.Empty<StylesheetRule>();
@@ -32,4 +41,4 @@ namespace Umbraco.Web.Editors
}
}
}
}

View File

@@ -241,10 +241,10 @@ namespace Umbraco.Web.Editors
// "rteApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<RichTextPreValueController>(
// controller => controller.GetConfiguration())
// },
{
"stylesheetApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<StylesheetController>(
controller => controller.GetAll())
},
// {
// "stylesheetApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<StylesheetController>(
// controller => controller.GetAll())
// },
{
"memberTypeApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<MemberTypeController>(
controller => controller.GetAllTypes())

View File

@@ -345,7 +345,6 @@
<Compile Include="Editors\MacroRenderingController.cs" />
<Compile Include="Editors\MemberTypeController.cs" />
<Compile Include="Editors\UpdateCheckController.cs" />
<Compile Include="Editors\StylesheetController.cs" />
<Compile Include="Editors\EntityController.cs" />
<Compile Include="Editors\MemberController.cs" />
<Compile Include="Editors\CurrentUserController.cs" />