Create blueprint from content integrated & working.

This commit is contained in:
Lars-Erik Aabech
2017-06-04 17:14:12 +02:00
parent 79fa7db631
commit 5fe22a2231
4 changed files with 12 additions and 14 deletions

View File

@@ -667,11 +667,11 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
createBlueprintFromContent: function(id, name) {
createBlueprintFromContent: function (contentId, name) {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl("contentApiBaseUrl", "CreateBlueprintFromContent", {
id: id, name: name
contentId: contentId, name: name
})
),
"Failed to create blueprint from content with id " + id

View File

@@ -1,16 +1,15 @@
(function() {
function CreateBlueprintController($scope,
contentResource,
appState,
navigationService,
editorState,
notificationService) {
function CreateBlueprintController(
$scope,
contentResource,
notificationService
) {
$scope.name = editorState.current.name;
$scope.name = $scope.currentNode.name;
$scope.create = function() {
contentResource.createBlueprintFromContent(editorState.current.id, $scope.name)
contentResource.createBlueprintFromContent($scope.currentNode.id, $scope.name)
.then(function() {
notificationService.showNotification({
type: 3,
@@ -26,8 +25,6 @@
[
"$scope",
"contentResource",
"navigationService",
"editorState",
"notificationsService",
CreateBlueprintController
]);

View File

@@ -5,7 +5,7 @@
<h5><localize key="create_createBlueprintFrom">Create a blueprint from</localize> {{currentNode.name}}</h5>
<label for="name"><localize key="create_blueprintName">Name</localize></label>
<input type="text" name="name" id="name" />
<input type="text" name="name" id="name" ng-model="name" />
</div>
</div>

View File

@@ -281,7 +281,8 @@ namespace Umbraco.Web.Editors
/// <param name="contentId">The content id to copy</param>
/// <param name="name">The name of the blueprint</param>
/// <returns></returns>
public IHttpActionResult CreateBlueprintFromContent(int contentId, string name)
[HttpPost]
public IHttpActionResult CreateBlueprintFromContent([FromUri]int contentId, [FromUri]string name)
{
var content = Services.ContentService.GetById(contentId);
if (content == null) return NotFound();