Can create blueprints from the tree

This commit is contained in:
Lars-Erik Aabech
2017-06-05 16:46:30 +02:00
parent 7f63919ba6
commit 88702f7e18
3 changed files with 31 additions and 5 deletions

View File

@@ -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);

View File

@@ -2,6 +2,8 @@
<content-editor content-id="contentId"
save-method="saveMethod"
get-method="getMethod"
get-scaffold-method="getScaffoldMethod"
is-new="isNew"
tree-alias="contentblueprints">
</content-editor>
</div>