discourse/app/assets/javascripts/wizard/models/wizard-field.js.es6

24 lines
407 B
Plaintext
Raw Normal View History

2016-08-25 13:14:56 -04:00
import ValidState from 'wizard/mixins/valid-state';
export default Ember.Object.extend(ValidState, {
id: null,
type: null,
value: null,
required: null,
warning: null,
2016-08-25 13:14:56 -04:00
check() {
if (!this.get('required')) {
this.setValid(true);
return true;
2016-08-25 13:14:56 -04:00
}
const val = this.get('value');
const valid = val && val.length > 0;
this.setValid(valid);
return valid;
2016-08-25 13:14:56 -04:00
}
2016-08-25 13:14:56 -04:00
});