Fixes deleting a template - uses the correct way to delete stuff with angular and not relying on legacy code
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @ngdoc controller
|
||||
* @name Umbraco.Editors.Templates.DeleteController
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* The controller for the template delete dialog
|
||||
*/
|
||||
function TemplatesDeleteController($scope, templateResource , treeService, navigationService) {
|
||||
|
||||
$scope.performDelete = function() {
|
||||
|
||||
//mark it for deletion (used in the UI)
|
||||
$scope.currentNode.loading = true;
|
||||
templateResource.deleteById($scope.currentNode.id).then(function () {
|
||||
$scope.currentNode.loading = false;
|
||||
|
||||
//get the root node before we remove it
|
||||
var rootNode = treeService.getTreeRoot($scope.currentNode);
|
||||
|
||||
//TODO: Need to sync tree, etc...
|
||||
treeService.removeNode($scope.currentNode);
|
||||
navigationService.hideMenu();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
navigationService.hideDialog();
|
||||
};
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Templates.DeleteController", TemplatesDeleteController);
|
||||
12
src/Umbraco.Web.UI.Client/src/views/templates/delete.html
Normal file
12
src/Umbraco.Web.UI.Client/src/views/templates/delete.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="umb-dialog umb-pane" ng-controller="Umbraco.Editors.Templates.DeleteController">
|
||||
<div class="umb-dialog-body">
|
||||
|
||||
<p class="umb-abstract">
|
||||
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong> ?
|
||||
</p>
|
||||
|
||||
<umb-confirm on-confirm="performDelete" on-cancel="cancel">
|
||||
</umb-confirm>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user