diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.controller.js new file mode 100644 index 0000000000..cdfe92d105 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.controller.js @@ -0,0 +1,29 @@ +/** + * @ngdoc controller + * @name Umbraco.Editors.StyleSheets.DeleteController + * @function + * + * @description + * The controller for deleting stylesheets + */ +function StyleSheetsDeleteController($scope, codefileResource, treeService, navigationService) { + + $scope.performDelete = function() { + + //mark it for deletion (used in the UI) + $scope.currentNode.loading = true; + + codefileResource.deleteByPath('stylesheets', $scope.currentNode.id) + .then(function() { + $scope.currentNode.loading = false; + treeService.removeNode($scope.currentNode); + navigationService.hideMenu(); + }); + }; + + $scope.cancel = function() { + navigationService.hideDialog(); + }; +} + +angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.DeleteController", StyleSheetsDeleteController); diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.html b/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.html new file mode 100644 index 0000000000..fd6f6edd78 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/delete.html @@ -0,0 +1,12 @@ +
+
+ +

+ Are you sure you want to delete {{currentNode.name}} ? +

+ + + + +
+
diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index a8b25b858b..0fd882863e 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -276,7 +276,7 @@ namespace Umbraco.Web.Editors /// /// Used to delete a specific file from disk via the FileService /// - /// This is a string but will be 'scripts' 'partialViews', 'partialViewMacros' + /// This is a string but will be 'scripts' 'partialViews', 'partialViewMacros' or 'stylesheets' /// The filename or urlencoded path of the file to delete /// Will return a simple 200 if file deletion succeeds [HttpDelete] @@ -327,6 +327,14 @@ namespace Umbraco.Web.Editors } return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Script or folder found with the specified path"); + case Core.Constants.Trees.Stylesheets: + if (Services.FileService.GetStylesheetByName(virtualPath) != null) + { + Services.FileService.DeleteStylesheet(virtualPath, Security.CurrentUser.Id); + return Request.CreateResponse(HttpStatusCode.OK); + } + return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Stylesheet found with the specified path"); + default: return Request.CreateResponse(HttpStatusCode.NotFound); }