From 2c2a9cc9161474a3ecc083d88a12cb5efa7566e7 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 9 Aug 2017 10:47:41 +0200 Subject: [PATCH] fixes: U4-10220 Missing the ability to create Content Templates (blueprints) from the blueprints tree directly when none exist --- .../contentblueprints/create.controller.js | 35 ++++++++++++++++ .../src/views/contentblueprints/create.html | 41 +++++++++++++++++++ .../umbraco/config/lang/en_us.xml | 1 + .../Trees/ContentBlueprintTreeController.cs | 5 ++- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.html diff --git a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.controller.js new file mode 100644 index 0000000000..31089f4281 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.controller.js @@ -0,0 +1,35 @@ +/** + * @ngdoc controller + * @name Umbraco.Editors.ContentBlueprint.CreateController + * @function + * + * @description + * The controller for creating content blueprints + */ +function ContentBlueprintCreateController($scope, $location, contentTypeResource, navigationService) { + + var vm = this; + var node = $scope.dialogOptions.currentNode; + + vm.createBlueprint = createBlueprint; + + function onInit() { + + vm.loading = true; + + contentTypeResource.getAll() + .then(function (documentTypes) { + vm.documentTypes = documentTypes; + vm.loading = false; + }); + } + + function createBlueprint(documentType) { + $location.path("/settings/contentBlueprints/edit/" + node.id).search("create", "true").search("doctype", documentType.alias); + navigationService.hideMenu(); + } + + onInit(); +} + +angular.module("umbraco").controller("Umbraco.Editors.ContentBlueprint.CreateController", ContentBlueprintCreateController); diff --git a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.html b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.html new file mode 100644 index 0000000000..7d04dfa771 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/create.html @@ -0,0 +1,41 @@ +
+ + + + + +
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 26d6e587b5..8041c9c08a 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -224,6 +224,7 @@ Where do you want to create the new %0% Create an item under + Select the document type you want to make a content template for Choose a type and a title "document types".]]> "media types".]]> diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index 12fcff2f56..0f9da51e63 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -100,8 +100,9 @@ namespace Umbraco.Web.Trees var menu = new MenuItemCollection(); if (id == Constants.System.Root.ToInvariantString()) - { - // root actions + { + // root actions + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); return menu; }