From 44ea6c56f5210e20e65a89c2bc9366f6929238f2 Mon Sep 17 00:00:00 2001 From: kjac Date: Tue, 1 Jul 2014 22:28:20 +0200 Subject: [PATCH] Use propertyAlias in fieldset validation As described in #162 the umbracoPropertyAlias has been removed in favor of a more unique propertyAlias. This propertyAlias should be used for property identification in the validation. --- app/directives/archetypeproperty.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/directives/archetypeproperty.js b/app/directives/archetypeproperty.js index 080e7d6..21baea7 100644 --- a/app/directives/archetypeproperty.js +++ b/app/directives/archetypeproperty.js @@ -129,25 +129,23 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c } // handle nested fieldset validation by storing the identifier of all invalid fieldset properties - var fieldsetIdentifier = scope.umbracoPropertyAlias + "_" + scope.fieldsetIndex; - var propertyIdentifier = fieldsetIdentifier + "_" + property.alias; - var propertyIdentifierIndex = ngModelCtrl.invalidProperties.indexOf(propertyIdentifier); + var propertyAliasIndex = ngModelCtrl.invalidProperties.indexOf(propertyAlias); if (valid == false) { - if (propertyIdentifierIndex == -1) { - ngModelCtrl.invalidProperties.push(propertyIdentifier); + if (propertyAliasIndex == -1) { + ngModelCtrl.invalidProperties.push(propertyAlias); } } else { - if (propertyIdentifierIndex != -1) { - ngModelCtrl.invalidProperties.splice(propertyIdentifierIndex, 1); + if (propertyAliasIndex != -1) { + ngModelCtrl.invalidProperties.splice(propertyAliasIndex, 1); } } if (markAsInvalid) { // mark the entire fieldset as invalid if there are any invalid properties in the fieldset, otherwise mark it as valid fieldset.isValid = - _.find(ngModelCtrl.invalidProperties, function (item) { - return item.indexOf(fieldsetIdentifier) == 0 + _.find(fieldset.properties, function (property) { + return property.isValid == false }) == null; }