Don't show (blank) for non blueprint content types (#3887)

This commit is contained in:
Kenn Jacobsen
2018-12-19 15:41:24 +01:00
committed by Sebastiaan Janssen
parent e41db72ef7
commit 9af6e3027f
2 changed files with 9 additions and 5 deletions

View File

@@ -605,13 +605,17 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie
//$scope.listViewAllowedTypes = getContentTypesCallback(id);
getContentTypesCallback(id).then(function (listViewAllowedTypes) {
var blueprints = false;
$scope.listViewAllowedTypes = listViewAllowedTypes;
angular.forEach(listViewAllowedTypes, function (allowedType) {
angular.forEach(allowedType.blueprints, function (value, key) {
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;
}
else {
blueprints = true;
});
}
});
if (listViewAllowedTypes.length === 1 && blueprints === false) {

View File

@@ -45,7 +45,7 @@
<li ng-repeat="contentType in listViewAllowedTypes | orderBy:'name':false">
<a href="" ng-click="createBlank(entityType,contentType.alias)" prevent-default>
<i class="{{contentType.icon}}"></i>
{{contentType.name}} <span ng-show="contentType.blueprints && contentType.blueprints.length != 0" style="text-transform: lowercase;">(<localize key="blueprints_blankBlueprint">blank</localize>)</span>
{{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" ng-click="createFromBlueprint(entityType,contentType.alias , key)" prevent-default>
&nbsp;&nbsp;<i class="{{contentType.icon}}"></i>