Make it possible to create folders for stylesheets

This commit is contained in:
Kenn Jacobsen
2019-01-21 19:02:52 +01:00
committed by Sebastiaan Janssen
parent e8cb30fbc4
commit de8516d2c7
5 changed files with 103 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ namespace Umbraco.Web.Editors
}
/// <summary>
/// Used to create a container/folder in 'partialViews', 'partialViewMacros' or 'scripts'
/// Used to create a container/folder in 'partialViews', 'partialViewMacros', 'scripts' or 'stylesheets'
/// </summary>
/// <param name="type">'partialViews', 'partialViewMacros' or 'scripts'</param>
/// <param name="parentId">The virtual path of the parent.</param>
@@ -111,6 +111,10 @@ namespace Umbraco.Web.Editors
virtualPath = NormalizeVirtualPath(name, SystemDirectories.Scripts);
Services.FileService.CreateScriptFolder(virtualPath);
break;
case Core.Constants.Trees.Stylesheets:
virtualPath = NormalizeVirtualPath(name, SystemDirectories.Css);
Services.FileService.CreateStyleSheetFolder(virtualPath);
break;
}
@@ -328,6 +332,11 @@ namespace Umbraco.Web.Editors
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Script or folder found with the specified path");
case Core.Constants.Trees.Stylesheets:
if (IsDirectory(virtualPath, SystemDirectories.Css))
{
Services.FileService.DeleteStyleSheetFolder(virtualPath);
return Request.CreateResponse(HttpStatusCode.OK);
}
if (Services.FileService.GetStylesheetByName(virtualPath) != null)
{
Services.FileService.DeleteStylesheet(virtualPath, Security.CurrentUser.Id);