Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
spruce committed Sep 12, 2015
1 parent 907b226 commit 8167388
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addon/components/em-form-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Syntax:
validationIcons: true
//Label of the form group, default is a human friendly form of the property name
label="Some label"
//if true show all errors, by default inherited from the form
showAllErrors=false
}}
*/
export default Ember.Component.extend(InFormMixin, HasPropertyMixin, HasPropertyValidationMixin, {
Expand Down Expand Up @@ -59,6 +61,7 @@ export default Ember.Component.extend(InFormMixin, HasPropertyMixin, HasProperty
}),
v_icons: Ember.computed.deprecatingAlias('validationIcons'),
validationIcons: Ember.computed.alias('form.validationIcons'),
showAllErrors: Em.computed.alias('form.showAllErrors'),
v_success_icon: Ember.computed.deprecatingAlias('successIcon'),
successIcon: 'fa fa-check',
v_warn_icon: Ember.computed.deprecatingAlias('warningIcon'),
Expand Down Expand Up @@ -86,6 +89,10 @@ export default Ember.Component.extend(InFormMixin, HasPropertyMixin, HasProperty
}
}
}),
canShowErrors: Ember.computed('showAllErrors', 'canShowErrorsFromFocus', function() {
return (this.get('showAllErrors')) || this.get('canShowErrorsFromFocus');
}),

hideValidationsOnFormChange: Ember.observer('form', 'form.model', function() {
this.set('canShowErrors', false);
}),
Expand All @@ -110,7 +117,7 @@ export default Ember.Component.extend(InFormMixin, HasPropertyMixin, HasProperty

focusIn() {
if (this.get('form.showErrorsOnFocusIn')) {
return this.set('canShowErrors', true);
return this.set('canShowErrorsFromFocus', true);
}
},

Expand Down
3 changes: 3 additions & 0 deletions addon/components/em-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Syntax:
submitButton=true|false
//if true validation icons will be rendered
validationIcons=true|false
//if true show all errors whether user entered something in the field or not
showAllErrors=true|false
}}
*/
export default Ember.Component.extend({
Expand Down Expand Up @@ -49,6 +51,7 @@ export default Ember.Component.extend({
submit_button: Ember.computed.deprecatingAlias('submitButton'),
submitButton: true,
v_icons: Ember.computed.deprecatingAlias('validationIcons'),
showAllErrors: false,
validationIcons: true,
showErrorsOnRender: false,
showErrorsOnFocusIn: false,
Expand Down

0 comments on commit 8167388

Please sign in to comment.