Fix: confusing validation present error for answer selection in poll participation
This commit is contained in:
parent
0460fe56b1
commit
2e128e3c3c
4 changed files with 13 additions and 2 deletions
|
@ -55,7 +55,14 @@ const SelectionValidations = buildValidations({
|
|||
return true;
|
||||
}
|
||||
},
|
||||
dependentKeys: ['forceAnswer', 'i18n.locale']
|
||||
messageKey() {
|
||||
if (this.get('model.isFreeText')) {
|
||||
return 'errors.present';
|
||||
} else {
|
||||
return 'errors.present.answer.selection';
|
||||
}
|
||||
},
|
||||
dependentKeys: ['isFreeText', 'forceAnswer', 'i18n.locale']
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -204,9 +211,10 @@ export default Ember.Controller.extend(Validations, {
|
|||
return Ember.Object.extend(SelectionValidations, {
|
||||
container,
|
||||
|
||||
// force Answer must be included in model
|
||||
// forceAnswer and isFreeText must be included in model
|
||||
// cause otherwise validations can't depend on it
|
||||
forceAnswer: this.get('forceAnswer'),
|
||||
isFreeText: this.get('isFreeText'),
|
||||
|
||||
// a little bit hacky
|
||||
// wasn't able to observe moment.locale since it should be in sync
|
||||
|
|
|
@ -101,6 +101,7 @@ export default {
|
|||
empty: '{{description}} darf nicht leer sein',
|
||||
blank: '{{description}} darf nicht leer sein',
|
||||
present: '{{description}} muss leer sein',
|
||||
'present.answer.selection': 'Eine Antwort muss ausgewählt sein',
|
||||
collection: '{{description}} muss eine Sammlung sein',
|
||||
singular: '{{description}} darf keine Sammlung sein',
|
||||
tooLong: '{{description}} ist zu lang (maximal {{max}} Zeichen)',
|
||||
|
|
|
@ -101,6 +101,7 @@ export default {
|
|||
empty: '{{description}} must not be empty',
|
||||
blank: '{{description}} must not be empty',
|
||||
present: '{{description}} must be empty',
|
||||
'present.answer.selection': 'An answer must be selected',
|
||||
collection: '{{description}} must be a collection',
|
||||
singular: '{{description}} must not be a collection',
|
||||
tooLong: '{{description}} is too long (maxl {{max}} characters)',
|
||||
|
|
|
@ -101,6 +101,7 @@ export default {
|
|||
empty: '{{description}} can\'t be empty',
|
||||
blank: '{{description}} can\'t be blank',
|
||||
present: '{{description}} must be blank',
|
||||
'present.answer.selection': 'An answer must be selected',
|
||||
collection: '{{description}} must be a collection',
|
||||
singular: '{{description}} can\'t be a collection',
|
||||
tooLong: '{{description}} is too long (maximum is {{max}} characters)',
|
||||
|
|
Loading…
Reference in a new issue