ce2a8c8e1f
also validation messages are missing
35 lines
772 B
JavaScript
35 lines
772 B
JavaScript
import DS from 'ember-data';
|
|
import {
|
|
validator, buildValidations
|
|
}
|
|
from 'ember-cp-validations';
|
|
/* global MF */
|
|
|
|
var Validations = buildValidations({
|
|
title: [
|
|
validator('iso8601-date', {
|
|
active() {
|
|
return this.get('model.poll.isFindADate') && !this.get('model.poll.isDateTime');
|
|
}
|
|
}),
|
|
validator('iso8601-datetime', {
|
|
active() {
|
|
return this.get('model.poll.isFindADate') && this.get('model.poll.isDateTime');
|
|
}
|
|
}),
|
|
validator('presence', {
|
|
presence() {
|
|
if (this.get('model.poll.isMakeAPoll')) {
|
|
return true;
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
})
|
|
]
|
|
});
|
|
|
|
export default MF.Fragment.extend(Validations, {
|
|
poll: MF.fragmentOwner(),
|
|
title: DS.attr('string')
|
|
});
|