diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 9ad4d38..c34ea7d 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -124,6 +124,24 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio } }); + $scope.autoPopulateAlias = function(s) { + var modelType = s.hasOwnProperty('fieldset') ? 'fieldset' : 'property'; + var modelProperty = s[modelType]; + + if (!modelProperty.aliasIsDirty) { + modelProperty.alias = modelProperty.label.toUmbracoAlias(); + } + } + + $scope.markAliasDirty = function(s) { + var modelType = s.hasOwnProperty('fieldset') ? 'fieldset' : 'property'; + var modelProperty = s[modelType]; + + if (!modelProperty.aliasIsDirty) { + modelProperty.aliasIsDirty = true;; + } + } + //helper that returns if an item can be removed $scope.canRemoveFieldset = function () { @@ -224,6 +242,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio _.each($scope.archetypeConfigRenderModel.fieldsets, function(fieldset){ fieldset.remove = false; + if (fieldset.alias.length > 0) + fieldset.aliasIsDirty = true; if(fieldset.label) { @@ -232,6 +252,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio _.each(fieldset.properties, function(fieldset){ fieldset.remove = false; + if (fieldset.alias.length > 0) + fieldset.aliasIsDirty = true; }); }); } diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index b7f3cc5..fedd05a 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -11,11 +11,11 @@
- +
- +
@@ -42,11 +42,11 @@
- +
- +