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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
433 B
JavaScript
Raw Normal View History

import EmberObject from "@ember/object";
2016-08-26 01:14:56 +08:00
import ValidState from "wizard/mixins/valid-state";
export default EmberObject.extend(ValidState, {
2016-08-26 01:14:56 +08:00
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
},
});