Updates how the validation works in the member model mapper to use the native validation stuff instead of custom pre-values.

This commit is contained in:
Shannon
2014-11-18 14:32:51 +11:00
parent ce80c9a244
commit 1accc6275a
4 changed files with 10 additions and 8 deletions

View File

@@ -1,11 +1,11 @@
<div>
<input type="email" name="textbox"
ng-model="model.value"
id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
ng-required="model.config.IsRequired"
val-server="value" />
ng-model="model.value"
id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
ng-required="model.config.IsRequired || model.validation.mandatory"
val-server="value" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="required">Required</span>
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="email">Invalid email</span>

View File

@@ -2,7 +2,7 @@
<input type="text" name="textbox" ng-model="model.value" id="{{model.alias}}"
class="umb-editor umb-textstring textstring"
val-server="value"
ng-required="model.config.IsRequired || model.validation.mandatory"
ng-required="model.validation.mandatory"
ng-trim="false" />
<span class="help-inline" val-msg-for="textbox" val-toggle-msg="required">Required</span>

View File

@@ -187,7 +187,7 @@ namespace Umbraco.Web.Models.Mapping
Label = ui.Text("general", "email"),
Value = display.Email,
View = "email",
Config = new Dictionary<string, object> { { "IsRequired", true } }
Validation = { Mandatory = true }
},
new ContentPropertyDisplay
{
@@ -259,7 +259,7 @@ namespace Umbraco.Web.Models.Mapping
if (member.HasIdentity == false || scenario == MembershipScenario.NativeUmbraco)
{
prop.View = "textbox";
prop.Config = new Dictionary<string, object> {{"IsRequired", true}};
prop.Validation.Mandatory = true;
}
else
{

View File

@@ -21,6 +21,8 @@ namespace Umbraco.Web.PropertyEditors
internal class EmailAddressePreValueEditor : PreValueEditor
{
//TODO: This doesn't seem necessary since it can be specified at the property type level - this will however be useful if/when
// we support overridden property value pre-value options.
[PreValueField("Required?", "boolean")]
public bool IsRequired { get; set; }
}