diff --git a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.controller.js index 8c98364295..cb8e091e50 100644 --- a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.controller.js @@ -7,9 +7,28 @@ * The controller for the content editor */ function ContentBlueprintEditController($scope, $routeParams, contentResource) { - $scope.contentId = $routeParams.id; + var excludedProps = ["_umb_urls", "_umb_releasedate", "_umb_expiredate", "_umb_template"]; + + function getScaffold() { + return contentResource.getScaffold(-1, $routeParams.doctype) + .then(function (scaffold) { + var lastTab = scaffold.tabs[scaffold.tabs.length - 1]; + lastTab.properties = _.filter(lastTab.properties, + function(p) { + return excludedProps.indexOf(p.alias) === -1; + }); + scaffold.allowPreview = false; + scaffold.allowedActions = ["A", "S", "C"]; + + return scaffold; + }); + } + + $scope.contentId = $routeParams.id; + $scope.isNew = $routeParams.id === "-1"; $scope.saveMethod = contentResource.saveBlueprint; $scope.getMethod = contentResource.getBlueprintById; + $scope.getScaffoldMethod = getScaffold; } angular.module("umbraco").controller("Umbraco.Editors.ContentBlueprint.EditController", ContentBlueprintEditController); diff --git a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.html b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.html index 3ca4b6447e..5d27978072 100644 --- a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/edit.html @@ -2,6 +2,8 @@ diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index 1b4af0f72b..ff029a020a 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -6,6 +6,7 @@ using System.Net; using System.Net.Http.Formatting; using System.Web.Http; using umbraco; +using umbraco.businesslogic.Actions; using umbraco.BusinessLogic.Actions; using Umbraco.Core; using Umbraco.Core.Services; @@ -91,17 +92,21 @@ namespace Umbraco.Web.Trees menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); return menu; } - var ct = Services.EntityService.Get(int.Parse(id), UmbracoObjectTypes.DocumentType); - //only refresh if it's a content type - if (ct != null) + var cte = Services.EntityService.Get(int.Parse(id), UmbracoObjectTypes.DocumentType); + //only refresh & create if it's a content type + if (cte != null) { + var ct = Services.ContentTypeService.GetContentType(cte.Id); + var createItem = menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionCreateBlueprintFromContent.Instance.Alias))); + createItem.NavigateToRoute("/settings/contentBlueprints/edit/-1?create=true&doctype=" + ct.Alias); + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); + return menu; } menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); - return menu; }