Merge branch 'pr/124' into develop

This commit is contained in:
Kevin Giszewski
2014-05-12 12:45:45 -04:00
21 changed files with 54 additions and 6 deletions
@@ -30,6 +30,9 @@ namespace Archetype.Models
public string Value { get; set; }
[JsonProperty("required")]
public bool Required { get; set; }
public bool Required { get; set; }
[JsonProperty("regEx")]
public bool RegEx { get; set; }
}
}
+8 -1
View File
@@ -43,7 +43,7 @@
cursor: "move",
handle: ".handle",
update: function (ev, ui) {
$scope.setDirty();
},
stop: function (ev, ui) {
@@ -67,6 +67,7 @@
$scope.model.value.fieldsets.push(newFieldset);
}
}
$scope.setDirty();
newFieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
$scope.focusFieldset(newFieldset);
@@ -76,6 +77,7 @@
$scope.removeRow = function ($index) {
if ($scope.canRemove()) {
if (confirm('Are you sure you want to remove this?')) {
$scope.setDirty();
$scope.model.value.fieldsets.splice($index, 1);
}
}
@@ -261,6 +263,11 @@
return (typeof property == 'undefined') ? true : property.isValid;
}
// helper to force the current form into the dirty state
$scope.setDirty = function () {
form.$setDirty();
}
//custom js
if ($scope.model.config.customJsPath) {
assetsService.loadJs($scope.model.config.customJsPath);
+21 -4
View File
@@ -97,10 +97,22 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
property.isValid = true;
var propertyConfig = getPropertyByAlias(configFieldsetModel, property.alias);
if(propertyConfig && propertyConfig.required && (property.value == null || property.value === "")){
fieldset.isValid = false;
property.isValid = false;
valid = false;
if (propertyConfig) {
if(propertyConfig.required && (property.value == null || property.value === "")) {
fieldset.isValid = false;
property.isValid = false;
valid = false;
}
// issue 116: RegEx validate property value
// Only validate the property value if anything has been entered - RegEx is considered a supplement to "required".
if (valid == true && propertyConfig.regEx && property.value) {
var regEx = new RegExp(propertyConfig.regEx);
if (regEx.test(property.value) == false) {
fieldset.isValid = false;
property.isValid = false;
valid = false;
}
}
}
});
});
@@ -143,6 +155,11 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
//watch for changes since there is no two-way binding with the local model.value
scope.$watch('model.value', function (newValue, oldValue) {
if (newValue == oldValue) {
//issue #121:
//don't update if there's nothing to update - if we do, the form will be considered dirty (even if the values are the same) and the user will be prompted to save/discard changes
return;
}
scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex].properties[renderModelPropertyIndex].value = newValue;
//trigger the validation pipeline
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Standard værdi",
"dataType": "Datatype",
"required": "Påkrævet",
"regEx": "RegEx validering",
"properties": "Egenskaber",
"labelTemplate": "Label skabelon",
"select": "Vælg",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+1
View File
@@ -27,6 +27,7 @@
"defaultValue": "Default Value",
"dataType": "DataType",
"required": "Required",
"regEx": "RegEx Validation",
"properties": "Properties",
"labelTemplate": "Label Template",
"select": "Select",
+4
View File
@@ -64,6 +64,10 @@
<label for="archetypePropertyRequired_{{$parent.$index}}_{{$index}}"><archetype-localize key="required">Required</archetype-localize></label>
<input type="checkbox" id="archetypePropertyRequired_{{$parent.$index}}_{{$index}}" ng-model="property.required" />
</div>
<div>
<label for="archetypePropertyRegEx_{{$parent.$index}}_{{$index}}"><archetype-localize key="regEx">RegEx Validation</archetype-localize></label>
<input type="text" id="archetypePropertyRegExValue_{{$parent.$index}}_{{$index}}" ng-model="property.regEx" />
</div>
</div>
</li>
</ul>