diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs index 002af11611..2e32adcb54 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs @@ -170,9 +170,9 @@ namespace Umbraco.Core.Persistence.Migrations.Initial private void CreateUmbracoUserTypeData() { - _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 1, Alias = "admin", Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7" }); + _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 1, Alias = "admin", Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7ï" }); _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 2, Alias = "writer", Name = "Writer", DefaultPermissions = "CAH:F" }); - _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 3, Alias = "editor", Name = "Editors", DefaultPermissions = "CADMOSKTPUZ:5F" }); + _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 3, Alias = "editor", Name = "Editors", DefaultPermissions = "CADMOSKTPUZ:5Fï" }); _database.Insert("umbracoUserType", "id", false, new UserTypeDto { Id = 4, Alias = "translator", Name = "Translator", DefaultPermissions = "AF" }); } diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js index f44401f5c5..f98937759e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js @@ -665,6 +665,17 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { [{ id: id }])), 'Failed to publish content with id ' + id); + }, + + createBlueprintFromContent: function(id, name) { + return umbRequestHelper.resourcePromise( + $http.post( + umbRequestHelper.getApiUrl("contentApiBaseUrl", "CreateBlueprintFromContent", { + id: id, name: name + }) + ), + "Failed to create blueprint from content with id " + id + ); } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js index 503caeb82d..e0e3bcee37 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js @@ -6,11 +6,29 @@ * @description * The controller for the content creation dialog */ -function contentCreateController($scope, $routeParams, contentTypeResource, iconHelper) { - - contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function(data) { +function contentCreateController($scope, $routeParams, contentTypeResource, iconHelper, $location) { + + contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function (data) { $scope.allowedTypes = iconHelper.formatContentTypeIcons(data); - }); + }); + + $scope.goToAction = function(docType) { + if (docType.blueprints && docType.blueprints.length) { + // Show dialog + } else { + $location.path( "/content/edit/" + + $scope.currentNode.id + + "?doctype=" + + docType.alias + + "&create=true" + ); + } + navigationService.hideNavigation(); + } + + $scope.createLinkAttributes = function(docType) { + return linkAttributes; + } } angular.module('umbraco').controller("Umbraco.Editors.Content.CreateController", contentCreateController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.createblueprint.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.createblueprint.controller.js new file mode 100644 index 0000000000..0ae435ddf1 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.createblueprint.controller.js @@ -0,0 +1,35 @@ +(function() { + + function CreateBlueprintController($scope, + contentResource, + appState, + navigationService, + editorState, + notificationService) { + + $scope.name = editorState.current.name; + + $scope.create = function() { + contentResource.createBlueprintFromContent(editorState.current.id, $scope.name) + .then(function() { + notificationService.showNotification({ + type: 3, + header: "Created blueprint", + message: "Blueprint was created based on " + $scope.name + }); + $scope.closeDialogs(); + }); + }; + } + + angular.module("umbraco").controller("Umbraco.Editors.Content.CreateBlueprintController", + [ + "$scope", + "contentResource", + "navigationService", + "editorState", + "notificationsService", + CreateBlueprintController + ]); + +}()); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/content/create.html b/src/Umbraco.Web.UI.Client/src/views/content/create.html index 73bdc5c188..b4b63d949e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/create.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/create.html @@ -9,31 +9,18 @@
diff --git a/src/Umbraco.Web.UI.Client/src/views/content/createblueprint.html b/src/Umbraco.Web.UI.Client/src/views/content/createblueprint.html new file mode 100644 index 0000000000..08fc36887a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/createblueprint.html @@ -0,0 +1,17 @@ +| t |