Deleting works, wired up some validation for duplicate names

This commit is contained in:
Shannon
2017-06-04 17:57:06 +02:00
parent b99b9b7a6b
commit 494a7d54b8
12 changed files with 79 additions and 13 deletions

View File

@@ -230,7 +230,8 @@
templateUrl: 'views/components/content/edit.html',
scope: {
contentId: "=",
createOptions: "="
createOptions: "=?",
page: "=?"
},
link: link
};

View File

@@ -269,6 +269,16 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
'Failed to delete item ' + id);
},
deleteBlueprint: function (id) {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"DeleteBlueprint",
[{ id: id }])),
'Failed to delete blueprint ' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getById

View File

@@ -9,6 +9,7 @@
function ContentEditController($scope, $routeParams) {
$scope.contentId = $routeParams.id;
$scope.page = $routeParams.page;
$scope.createOptions = null;
if ($routeParams.create && $routeParams.doctype) {
$scope.createOptions = {

View File

@@ -1,5 +1,6 @@
<div ng-controller="Umbraco.Editors.Content.EditController">
<content-editor create-options="createOptions"
content-id="contentId">
content-id="contentId"
page="page">
</content-editor>
</div>

View File

@@ -6,14 +6,14 @@
* @description
* The controller for deleting content blueprints
*/
function ContentBlueprintDeleteController($scope, codefileResource, treeService, navigationService) {
function ContentBlueprintDeleteController($scope, contentResource, treeService, navigationService) {
$scope.performDelete = function() {
//mark it for deletion (used in the UI)
$scope.currentNode.loading = true;
codefileResource.deleteByPath('partialViews', $scope.currentNode.id)
contentResource.deleteBlueprint($scope.currentNode.id)
.then(function() {
$scope.currentNode.loading = false;
//get the root node before we remove it

View File

@@ -0,0 +1,13 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.Content.EditController
* @function
*
* @description
* The controller for the content editor
*/
function ContentBlueprintEditController($scope, $routeParams) {
$scope.contentId = $routeParams.id;
}
angular.module("umbraco").controller("Umbraco.Editors.ContentBlueprint.EditController", ContentEditController);

View File

@@ -1,3 +1,4 @@
<div>
<content-editor></content-editor>
<div ng-controller="Umbraco.Editors.ContentBlueprint.EditController">
<content-editor content-id="contentId">
</content-editor>
</div>