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

36 lines
793 B
JavaScript

import Ember from 'ember';
import {
validator, buildValidations
}
from 'ember-cp-validations';
var Validations = buildValidations({
options: [
validator('collection', true),
validator('length', {
dependentKeys: ['options.[]'],
min() {
if (this.get('isFindADate') && this.get('isDateTime')) {
return 1;
}
else {
return 2;
}
}
// message: Ember.I18n.t('create.options.error.notEnoughOptions')
}),
validator('valid-collection', {
dependentKeys: ['options.[]', 'options.@each.title']
})
]
});
export default Ember.Component.extend(Validations, {
actions: {
submit: function(){
if (this.get('validations.isValid')) {
this.sendAction('nextPage');
}
}
}
});