decide.nolog.cz/app/models/option.js
jelhan ce2a8c8e1f done most things except date with times
also validation messages are missing
2016-01-19 04:56:51 +01:00

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')
});