Skip to content

Commit

Permalink
refactor to be in line with Emerson/ember-form-master-2000#38
Browse files Browse the repository at this point in the history
  • Loading branch information
jelhan committed Nov 22, 2015
1 parent ae52eb8 commit 798527a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 8 additions & 3 deletions app/components/fm-input-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,20 @@ export default Ember.Component.extend({

errors: [],

errorClass: Ember.computed('errors', 'shouldShowErrors', function() {
if(!Ember.isEmpty(this.get('errors')) && this.get('shouldShowErrors')) {
return this.fmconfig.errorClass;
errorClass: Ember.computed('showErrors', 'errors', function() {
if(this.get('showErrors')) {
return this.get('fmConfig').errorClass;
}
}),

fmConfig: Ember.inject.service('fm-config'),

minimumInputFields: 1,

shouldShowErrors: false,
showErrors: Ember.computed('shouldShowErrors', 'errors', function() {
return this.get('shouldShowErrors') && !Ember.isEmpty(this.get('errors'));
}),

step: undefined,

Expand Down
10 changes: 4 additions & 6 deletions app/templates/components/fm-input-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
</div>
{{/each}}

{{#if errors}}
{{#if shouldShowErrors}}
<div class='col-sm-10 col-sm-offset-2'>
{{fm-errortext errors=errors}}
</div>
{{/if}}
{{#if showErrors}}
<div class='col-sm-10 col-sm-offset-2'>
{{fm-errortext errors=errors}}
</div>
{{/if}}

0 comments on commit 798527a

Please sign in to comment.