From 525b229b42edf44d4fdff834354721ca5e840d6a Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 2 Jan 2019 15:20:25 +0100 Subject: [PATCH] Fix content creation from list views --- .../listview/listview.controller.js | 23 +++++++++++++------ .../propertyeditors/listview/listview.html | 16 ++++++------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 1d8cdfa03f..96e7ccdbfd 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -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; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html index 44636d7033..77576cac6a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html @@ -27,10 +27,10 @@ - - + + - {{::value}} + {{::blueprint.name}} @@ -48,9 +48,9 @@ {{::contentType.name}} (blank) - +    - {{::value}} + {{::blueprint.name}} @@ -58,11 +58,11 @@