2015-10-13 11:29:51 +02:00
|
|
|
import DS from 'ember-data';
|
2016-01-19 04:56:51 +01:00
|
|
|
import {
|
|
|
|
validator, buildValidations
|
|
|
|
}
|
|
|
|
from 'ember-cp-validations';
|
2015-11-20 11:31:40 +01:00
|
|
|
/* global MF */
|
2015-10-13 11:29:51 +02:00
|
|
|
|
2016-01-19 04:56:51 +01:00
|
|
|
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(),
|
2015-10-13 11:29:51 +02:00
|
|
|
title: DS.attr('string')
|
2015-11-20 01:09:37 +01:00
|
|
|
});
|