2018-06-15 11:03:24 -04:00
|
|
|
import ValidState from "wizard/mixins/valid-state";
|
2016-08-25 13:14:56 -04:00
|
|
|
|
|
|
|
export default Ember.Object.extend(ValidState, {
|
|
|
|
id: null,
|
|
|
|
type: null,
|
|
|
|
value: null,
|
|
|
|
required: null,
|
2016-09-20 12:28:22 -04:00
|
|
|
warning: null,
|
2016-08-25 13:14:56 -04:00
|
|
|
|
|
|
|
check() {
|
2018-06-15 11:03:24 -04:00
|
|
|
if (!this.get("required")) {
|
2016-09-20 12:28:22 -04:00
|
|
|
this.setValid(true);
|
|
|
|
return true;
|
2016-08-25 13:14:56 -04:00
|
|
|
}
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
const val = this.get("value");
|
2016-09-20 12:28:22 -04:00
|
|
|
const valid = val && val.length > 0;
|
|
|
|
|
|
|
|
this.setValid(valid);
|
|
|
|
return valid;
|
2016-08-25 13:14:56 -04:00
|
|
|
}
|
|
|
|
});
|