857f2baa16
* replace ember-cp-validations with custom validation logic for poll creation * refactor poll participation to not use ember-cp-validations * drop ember-cp-validations from create.settings route * remove unused leftovers from ember-cp-validations * fix potential leak * assertion thrown in CI tests (Firefox) indicate that listener is cleaned up automatically * synchronize translations
26 lines
796 B
JavaScript
26 lines
796 B
JavaScript
import BaseBsFormElement from 'ember-bootstrap/components/bs-form/element';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class BsFormElement extends BaseBsFormElement {
|
|
'__ember-bootstrap_subclass' = true;
|
|
|
|
@service intl;
|
|
|
|
get errors() {
|
|
// native validation state doesn't integrate with Ember's autotracking, so we need to invalidate our `errors` getter explicitly when
|
|
// `this.value` changes by consuming it here.
|
|
// eslint-disable-next-line no-unused-vars
|
|
const { model, property } = this.args;
|
|
const validation = model[`${property}Validation`];
|
|
|
|
if (validation === undefined || validation === null) {
|
|
return [];
|
|
}
|
|
|
|
return [this.intl.t(validation.key, validation.options)];
|
|
}
|
|
|
|
get hasValidator() {
|
|
return true;
|
|
}
|
|
}
|