mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
No validations on setup for empty fields
refs #5652 - new action on focusOut which only calls validate if the fields has a value
This commit is contained in:
parent
0a924451eb
commit
b14f918b71
@ -49,6 +49,16 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||
},
|
||||
|
||||
actions: {
|
||||
preValidate: function (model) {
|
||||
var self = this;
|
||||
if (this.get(model)) {
|
||||
if (model === 'email') {
|
||||
self.send('handleEmail');
|
||||
}
|
||||
this.validate({property: model});
|
||||
}
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
var self = this,
|
||||
data = self.getProperties('blogTitle', 'name', 'email', 'password', 'image'),
|
||||
|
@ -11,28 +11,28 @@
|
||||
{{#gh-form-group errors=errors property="email"}}
|
||||
<label for="email-address">Email address</label>
|
||||
<span class="input-icon icon-mail">
|
||||
{{gh-trim-focus-input tabindex="1" type="email" name="email" placeholder="Eg. john@example.com" autocorrect="off" value=email focusOut=(action "handleEmail")}}
|
||||
{{gh-trim-focus-input tabindex="1" type="email" name="email" placeholder="Eg. john@example.com" autocorrect="off" value=email focusOut=(action "preValidate" "email")}}
|
||||
</span>
|
||||
{{gh-error-message errors=errors property="email"}}
|
||||
{{/gh-form-group}}
|
||||
{{#gh-form-group errors=errors property="name"}}
|
||||
<label for="full-name">Full name</label>
|
||||
<span class="input-icon icon-user">
|
||||
{{gh-input tabindex="2" type="text" name="name" placeholder="Eg. John H. Watson" autocorrect="off" value=name focusOut=(action "validate" "name")}}
|
||||
{{gh-input tabindex="2" type="text" name="name" placeholder="Eg. John H. Watson" autocorrect="off" value=name focusOut=(action "preValidate" "name")}}
|
||||
</span>
|
||||
{{gh-error-message errors=errors property="name"}}
|
||||
{{/gh-form-group}}
|
||||
{{#gh-form-group errors=errors property="password"}}
|
||||
<label for="password">Password</label>
|
||||
<span class="input-icon icon-lock">
|
||||
{{gh-input tabindex="3" type="password" name="password" placeholder="At least 8 characters" autocorrect="off" value=password focusOut=(action "validate" "password")}}
|
||||
{{gh-input tabindex="3" type="password" name="password" placeholder="At least 8 characters" autocorrect="off" value=password focusOut=(action "preValidate" "password")}}
|
||||
</span>
|
||||
{{gh-error-message errors=errors property="password"}}
|
||||
{{/gh-form-group}}
|
||||
{{#gh-form-group errors=errors property="blogTitle"}}
|
||||
<label for="blog-title">Blog title</label>
|
||||
<span class="input-icon icon-content">
|
||||
{{gh-input tabindex="4" type="text" name="blog-title" placeholder="Eg. The Daily Awesome" autocorrect="off" value=blogTitle focusOut=(action "validate" "blogTitle")}}
|
||||
{{gh-input tabindex="4" type="text" name="blog-title" placeholder="Eg. The Daily Awesome" autocorrect="off" value=blogTitle focusOut=(action "preValidate" "blogTitle")}}
|
||||
</span>
|
||||
{{gh-error-message errors=errors property="blogTitle"}}
|
||||
{{/gh-form-group}}
|
||||
|
Loading…
Reference in New Issue
Block a user