Skip to content

Commit

Permalink
yield isTouched and isInvalidAndTouched
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Mar 6, 2017
1 parent 96a09fb commit 4b168ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addon/components/paper-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export default Component.extend(ParentMixin, {
return this.get('childComponents').isAny('isTouched');
}),

isInvalidAndTouched: computed.and('isInvalid', 'isTouched'),

submit() {
this.send('onSubmit');
return false;
Expand All @@ -38,7 +40,7 @@ export default Component.extend(ParentMixin, {
actions: {
onValidityChange() {
if (this.get('lastIsValid') !== this.get('isValid')) {
this.sendAction('onValidityChange', this.get('isValid'), this.get('isTouched'), this.get('isInvalid') && this.get('isTouched'));
this.sendAction('onValidityChange', this.get('isValid'), this.get('isTouched'), this.get('isInvalidAndTouched'));
this.set('lastIsValid', this.get('isValid'));
}
},
Expand Down
2 changes: 2 additions & 0 deletions addon/templates/components/paper-form.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{{yield (hash
isValid=isValid
isInvalid=isInvalid
isTouched=isTouched
isInvalidAndTouched=isInvalidAndTouched
input=(component inputComponent
parentComponent=this
onValidityChange=(action "onValidityChange")
Expand Down

0 comments on commit 4b168ec

Please sign in to comment.