decide.nolog.cz/app/components/fm-radio-group.js
jelhan 01f9b6e61f extract participation form from participants table and make it a bootstrap form
started replacing ember-easy-form-extensions by ember-form-master-2000
and ember-validations by ember-cp-validations

using ember-form-master-2000 in old 0.2 release cause newer releases does not work with ember 0.12
should move to ember 2.x as soon as possible
therefore ember-easy-form-extensions has to be dropped and ember-i18n been updated

part of #76
2015-11-12 15:52:14 +01:00

34 lines
1 KiB
JavaScript

import FmRadioGroup from 'ember-form-master-2000/components/fm-radio-group';
import Ember from 'ember';
export default FmRadioGroup.reopen({
actions: {
// backport feature: do not show errors before user interaction
userInteraction() {
if (!this.get('shouldShowErrors')) {
this.set('shouldShowErrors', true);
}
}
},
// backport
// * fix: do not show has-errors if errors array is empty
// https://github.com/Emerson/ember-form-master-2000/pull/33
// * feature: do not show errors before user interaction
errorClass: Ember.computed('errors', 'shouldShowErrors', function() {
if(!Ember.isEmpty(this.get('errors')) && this.get('shouldShowErrors')) {
return this.fmconfig.errorClass;
}
}),
fieldWrapperClass: Ember.computed(function() {
return this.fmconfig.fieldWrapperClass;
}),
labelClass: Ember.computed(function() {
return this.fmconfig.labelClass;
}),
// backport feature: do not show errors before user interaction
shouldShowErrors: false
});