Fix the content template selector in the content tree

This commit is contained in:
Kenn Jacobsen
2019-01-02 14:58:18 +01:00
committed by Sebastiaan Janssen
parent 525b229b42
commit 4b60d8bca6
2 changed files with 14 additions and 7 deletions

View File

@@ -42,14 +42,21 @@ function contentCreateController($scope,
}
function createOrSelectBlueprintIfAny(docType) {
var blueprintIds = _.keys(docType.blueprints || {});
// map the blueprints into a collection that's sortable in the view
var blueprints = _.map(_.pairs(docType.blueprints || {}), function (pair) {
return {
id: pair[0],
name: pair[1]
};
});
$scope.docType = docType;
if (blueprintIds.length) {
if (blueprints.length) {
if (blueprintConfig.skipSelect) {
createFromBlueprint(blueprintIds[0]);
createFromBlueprint(blueprints[0].id);
} else {
$scope.selectContentType = false;
$scope.selectBlueprint = true;
$scope.selectableBlueprints = blueprints;
}
} else {
createBlank(docType);

View File

@@ -25,13 +25,13 @@
</li>
</ul>
<ul class="umb-actions umb-actions-child" ng-if="selectBlueprint && docType.blueprints.length > 0">
<ul class="umb-actions umb-actions-child" ng-if="selectBlueprint">
<li class="umb-action" ng-repeat="(key, value) in docType.blueprints | orderBy:'name':false">
<a class="umb-action-link" ng-click="createFromBlueprint(key)">
<li class="umb-action" ng-repeat="blueprint in selectableBlueprints | orderBy:'name':false">
<a class="umb-action-link" ng-click="createFromBlueprint(blueprint.id)">
<i class="large icon {{docType.icon}}"></i>
<span class="menu-label">
{{value}}
{{blueprint.name}}
</span>
</a>
</li>