Merge branch 'feature/5702-custom-validation-messages' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-feature/5702-custom-validation-messages
# Conflicts: # src/Umbraco.Core/PropertyEditors/Validators/RegexValidator.cs
This commit is contained in:
@@ -11,10 +11,17 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
internal class ContentPropertyDto : ContentPropertyBasic
|
||||
{
|
||||
public IDataType DataType { get; set; }
|
||||
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public bool IsRequired { get; set; }
|
||||
|
||||
public string IsRequiredMessage { get; set; }
|
||||
|
||||
public string ValidationRegExp { get; set; }
|
||||
|
||||
public string ValidationRegExpMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,13 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[DataMember(Name = "mandatory")]
|
||||
public bool Mandatory { get; set; }
|
||||
|
||||
[DataMember(Name = "mandatoryMessage")]
|
||||
public string MandatoryMessage { get; set; }
|
||||
|
||||
[DataMember(Name = "pattern")]
|
||||
public string Pattern { get; set; }
|
||||
|
||||
[DataMember(Name = "patternMessage")]
|
||||
public string PatternMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
|
||||
//add the validation information
|
||||
dest.Validation.Mandatory = originalProp.PropertyType.Mandatory;
|
||||
dest.Validation.MandatoryMessage = originalProp.PropertyType.MandatoryMessage;
|
||||
dest.Validation.Pattern = originalProp.PropertyType.ValidationRegExp;
|
||||
dest.Validation.PatternMessage = originalProp.PropertyType.ValidationRegExpMessage;
|
||||
|
||||
if (dest.PropertyEditor == null)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
base.Map(property, dest, context);
|
||||
|
||||
dest.IsRequired = property.PropertyType.Mandatory;
|
||||
dest.IsRequiredMessage = property.PropertyType.MandatoryMessage;
|
||||
dest.ValidationRegExp = property.PropertyType.ValidationRegExp;
|
||||
dest.ValidationRegExpMessage = property.PropertyType.ValidationRegExpMessage;
|
||||
dest.Description = property.PropertyType.Description;
|
||||
dest.Label = property.PropertyType.Name;
|
||||
dest.DataType = DataTypeService.GetDataType(property.PropertyType.DataTypeId);
|
||||
|
||||
@@ -222,7 +222,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
target.DataTypeId = source.DataTypeId;
|
||||
target.DataTypeKey = source.DataTypeKey;
|
||||
target.Mandatory = source.Validation.Mandatory;
|
||||
target.MandatoryMessage = source.Validation.MandatoryMessage;
|
||||
target.ValidationRegExp = source.Validation.Pattern;
|
||||
target.ValidationRegExpMessage = source.Validation.PatternMessage;
|
||||
target.Variations = source.AllowCultureVariant ? ContentVariation.Culture : ContentVariation.Nothing;
|
||||
|
||||
if (source.Id > 0)
|
||||
|
||||
@@ -223,7 +223,13 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Alias = p.Alias,
|
||||
Description = p.Description,
|
||||
Editor = p.PropertyEditorAlias,
|
||||
Validation = new PropertyTypeValidation {Mandatory = p.Mandatory, Pattern = p.ValidationRegExp},
|
||||
Validation = new PropertyTypeValidation
|
||||
{
|
||||
Mandatory = p.Mandatory,
|
||||
MandatoryMessage = p.MandatoryMessage,
|
||||
Pattern = p.ValidationRegExp,
|
||||
PatternMessage = p.ValidationRegExpMessage,
|
||||
},
|
||||
Label = p.Name,
|
||||
View = propertyEditor.GetValueEditor().View,
|
||||
Config = config,
|
||||
|
||||
Reference in New Issue
Block a user