Create blueprint from content integrated & working.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
]);
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user