From 7e8364eae48be9bbd3a160c3f3aab03eb374ab1f Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 15 Aug 2019 13:10:17 +0200 Subject: [PATCH] V8: Support mixed element variance in Nested Content (#5952) (cherry picked from commit e7a9ee8142b45de6633a10b923d84e84f0b9d0ef) --- .../nestedcontent/nestedcontent.controller.js | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js index 7ead8974d8..aaf7ed08bb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js @@ -489,32 +489,30 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop node.key = fromNcEntry && fromNcEntry.key ? fromNcEntry.key : String.CreateGuid(); - for (var v = 0; v < node.variants.length; v++) { - var variant = node.variants[v]; - - for (var t = 0; t < variant.tabs.length; t++) { - var tab = variant.tabs[t]; + var variant = node.variants[0]; + + for (var t = 0; t < variant.tabs.length; t++) { + var tab = variant.tabs[t]; - for (var p = 0; p < tab.properties.length; p++) { - var prop = tab.properties[p]; + for (var p = 0; p < tab.properties.length; p++) { + var prop = tab.properties[p]; - prop.propertyAlias = prop.alias; - prop.alias = $scope.model.alias + "___" + prop.alias; - // Force validation to occur server side as this is the - // only way we can have consistency between mandatory and - // regex validation messages. Not ideal, but it works. - prop.validation = { - mandatory: false, - pattern: "" - }; + prop.propertyAlias = prop.alias; + prop.alias = $scope.model.alias + "___" + prop.alias; + // Force validation to occur server side as this is the + // only way we can have consistency between mandatory and + // regex validation messages. Not ideal, but it works. + prop.validation = { + mandatory: false, + pattern: "" + }; - if (fromNcEntry && fromNcEntry[prop.propertyAlias]) { - prop.value = fromNcEntry[prop.propertyAlias]; - } + if (fromNcEntry && fromNcEntry[prop.propertyAlias]) { + prop.value = fromNcEntry[prop.propertyAlias]; } } } - + $scope.nodes.push(node); return node;