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

23 lines
392 B
Plaintext
Raw Normal View History

2018-06-15 23:03:24 +08:00
import ValidState from "wizard/mixins/valid-state";
2016-08-26 01:14:56 +08:00
export default Ember.Object.extend(ValidState, {
id: null,
type: null,
value: null,
required: null,
warning: null,
2016-08-26 01:14:56 +08:00
check() {
if (!this.required) {
this.setValid(true);
return true;
2016-08-26 01:14:56 +08:00
}
const val = this.value;
const valid = val && val.length > 0;
this.setValid(valid);
return valid;
2016-08-26 01:14:56 +08:00
}
});