From 7831e476e37979be9e8086c0c5e2e26c4522bc26 Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Mon, 17 Feb 2014 15:17:57 -0700 Subject: [PATCH] Ensure property containers use unique IDs with multiple fieldsets ...by adding the current Archetype's Umbraco Property Alias to the ID string Old: archetype-property-0-0 New: archetype-property-sliderItems-0-0 Need to DRY this up later ;) --- app/directives/archetypeproperty.js | 10 ++++++---- app/views/archetype.html | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/directives/archetypeproperty.js b/app/directives/archetypeproperty.js index 8355696..fa7a945 100644 --- a/app/directives/archetypeproperty.js +++ b/app/directives/archetypeproperty.js @@ -55,6 +55,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c var config = null; var alias = configFieldsetModel.properties[scope.propertyConfigIndex].alias; var defaultValue = configFieldsetModel.properties[scope.propertyConfigIndex].value; + var umbracoPropertyAlias = scope.umbracoPropertyAlias; //try to convert the defaultValue to a JS object defaultValue = jsonOrString(defaultValue, scope.archetypeConfig.developerMode, "defaultValue"); @@ -81,7 +82,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c } var mergedConfig = _.extend(defaultConfigObj, config); - loadView(pathToView, mergedConfig, defaultValue, alias, scope, element, ngModelCtrl); + loadView(pathToView, mergedConfig, defaultValue, alias, umbracoPropertyAlias, scope, element, ngModelCtrl); }); }); @@ -111,7 +112,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c } } - function loadView(view, config, defaultValue, alias, scope, element, ngModelCtrl) { + function loadView(view, config, defaultValue, alias, umbracoPropertyAlias, scope, element, ngModelCtrl) { if (view) { $http.get(view).success(function (data) { @@ -139,7 +140,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c scope.model.config = config; //some items need an alias - scope.model.alias = "archetype-property-" + scope.fieldsetIndex + "-" + scope.propertyConfigIndex; + scope.model.alias = "archetype-property-" + umbracoPropertyAlias + "-" + scope.fieldsetIndex + "-" + scope.propertyConfigIndex; //watch for changes since there is no two-way binding with the local model.value scope.$watch('model.value', function (newValue, oldValue) { @@ -167,7 +168,8 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c archetypeConfig: '=', fieldset: '=', fieldsetIndex: '=', - archetypeRenderModel: '=' + archetypeRenderModel: '=', + umbracoPropertyAlias: '=' } } }); \ No newline at end of file diff --git a/app/views/archetype.html b/app/views/archetype.html index 7c43759..5877477 100644 --- a/app/views/archetype.html +++ b/app/views/archetype.html @@ -30,7 +30,7 @@
-