decide.nolog.cz/app/models/option.js

36 lines
772 B
JavaScript
Raw Normal View History

2015-10-13 11:29:51 +02:00
import DS from 'ember-data';
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
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')
});