Fix content creation from list views
This commit is contained in:
committed by
Sebastiaan Janssen
parent
2dfbb1d555
commit
525b229b42
@@ -701,16 +701,23 @@ function listViewController($scope, $routeParams, $injector, $timeout, currentUs
|
||||
}
|
||||
|
||||
getContentTypesCallback(id).then(function (listViewAllowedTypes) {
|
||||
$scope.listViewAllowedTypes = listViewAllowedTypes;
|
||||
$scope.listViewAllowedTypes = listViewAllowedTypes;
|
||||
|
||||
var blueprints = false;
|
||||
_.each(listViewAllowedTypes, function (allowedType) {
|
||||
if (_.isEmpty(allowedType.blueprints)) {
|
||||
// this helps the view understand that there are no blueprints available
|
||||
allowedType.blueprints = null;
|
||||
// this helps the view understand that there are no blueprints available
|
||||
allowedType.blueprints = null;
|
||||
}
|
||||
else {
|
||||
blueprints = true;
|
||||
blueprints = true;
|
||||
// turn the content type blueprints object into an array of sortable objects for the view
|
||||
allowedType.blueprints = _.map(_.pairs(allowedType.blueprints || {}), function (pair) {
|
||||
return {
|
||||
id: pair[0],
|
||||
name: pair[1]
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -776,17 +783,19 @@ function listViewController($scope, $routeParams, $injector, $timeout, currentUs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createBlank(entityType, docTypeAlias) {
|
||||
$location
|
||||
.path("/" + entityType + "/" + entityType + "/edit/" + $scope.contentId)
|
||||
.search("doctype=" + docTypeAlias + "&create=true");
|
||||
.search("doctype", docTypeAlias)
|
||||
.search("create", "true");
|
||||
}
|
||||
|
||||
function createFromBlueprint(entityType, docTypeAlias, blueprintId) {
|
||||
$location
|
||||
.path("/" + entityType + "/" + entityType + "/edit/" + $scope.contentId)
|
||||
.search("doctype=" + docTypeAlias + "&create=true&blueprintId=" + blueprintId);
|
||||
.search("doctype", docTypeAlias)
|
||||
.search("create", "true")
|
||||
.search("blueprintId", blueprintId);
|
||||
}
|
||||
|
||||
$scope.createBlank = createBlank;
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
</a>
|
||||
|
||||
<umb-dropdown ng-if="page.createDropdownOpen" on-close="page.createDropdownOpen = false">
|
||||
<umb-dropdown-item ng-repeat="(key, value) in listViewAllowedTypes[0].blueprints track by key">
|
||||
<a ng-click="createFromBlueprint(entityType, listViewAllowedTypes[0].blueprints.alias, key)">
|
||||
<umb-dropdown-item ng-repeat="blueprint in listViewAllowedTypes[0].blueprints | orderBy:'name':false">
|
||||
<a ng-click="createFromBlueprint(entityType, listViewAllowedTypes[0].alias, blueprint.id)">
|
||||
<i class="{{::listViewAllowedTypes[0].icon}}"></i>
|
||||
{{::value}}
|
||||
{{::blueprint.name}}
|
||||
</a>
|
||||
</umb-dropdown-item>
|
||||
</umb-dropdown>
|
||||
@@ -48,9 +48,9 @@
|
||||
<i class="{{::contentType.icon}}"></i>
|
||||
{{::contentType.name}} <span ng-show="contentType.blueprints" style="text-transform: lowercase;">(<localize key="blueprints_blankBlueprint">blank</localize>)</span>
|
||||
</a>
|
||||
<a href="" ng-repeat="(key, value) in contentType.blueprints track by key" ng-click="createFromBlueprint(entityType,contentType.alias , key)" prevent-default>
|
||||
<a href="" ng-repeat="blueprint in contentType.blueprints | orderBy:'name':false" ng-click="createFromBlueprint(entityType, contentType.alias, blueprint.id)" prevent-default>
|
||||
<i class="{{::contentType.icon}}"></i>
|
||||
{{::value}}
|
||||
{{::blueprint.name}}
|
||||
</a>
|
||||
</umb-dropdown-item>
|
||||
</umb-dropdown>
|
||||
@@ -58,11 +58,11 @@
|
||||
|
||||
<ul class="umb-actions umb-actions-child">
|
||||
|
||||
<li ng-repeat="(key, value) in docType.blueprints | orderBy:'name':false">
|
||||
<a ng-click="createFromBlueprint(key)">
|
||||
<li ng-repeat="blueprint in docType.blueprints | orderBy:'name':false">
|
||||
<a ng-click="createFromBlueprint(blueprint.id)">
|
||||
<i class="large {{docType.icon}}"></i>
|
||||
<span class="menu-label">
|
||||
{{value}}
|
||||
{{blueprint.name}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user