5b8d59c00b
ToDo left: refactor `datetimes` property of `create-options-datetime` component to not cause whole list to be updated. This is not only a performance issue but also UX: e.g. validation state is lost when another item is added.
16 lines
412 B
JavaScript
16 lines
412 B
JavaScript
import Alias from 'ember-cp-validations/validators/alias';
|
|
import Ember from 'ember';
|
|
|
|
const { get } = Ember;
|
|
|
|
const ModelAlias = Alias.extend({
|
|
validate(value, options, model, attribute) {
|
|
const optionsModel = get(options, 'model');
|
|
if (optionsModel) {
|
|
model = get(model, optionsModel);
|
|
}
|
|
return this._super(value, options, model, attribute) || true;
|
|
}
|
|
});
|
|
|
|
export default ModelAlias;
|