\ No newline at end of file
diff --git a/app/components/model-form/select-input.js b/app/components/model-form/select-input.js
deleted file mode 100644
index 566c7ff5d..000000000
--- a/app/components/model-form/select-input.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import ModelFormTextInputComponent from './text-input';
-
-export default ModelFormTextInputComponent.extend({
- options: null,
-});
diff --git a/app/components/model-form/select-input.ts b/app/components/model-form/select-input.ts
new file mode 100644
index 000000000..05fe48571
--- /dev/null
+++ b/app/components/model-form/select-input.ts
@@ -0,0 +1,3 @@
+import TextInput from './text-input';
+
+export default class SelectInput extends TextInput {}
diff --git a/app/components/model-form/text-input.hbs b/app/components/model-form/text-input.hbs
index c2f15b808..6003a98aa 100644
--- a/app/components/model-form/text-input.hbs
+++ b/app/components/model-form/text-input.hbs
@@ -1,44 +1,46 @@
-{{#if (eq inputLayout 'vertical')}}
-
+ {{#if (eq @inputLayout 'vertical')}}
+
+
- {{form-control-feedback (get @model.errors property)}}
-{{else}}
-
-
\ No newline at end of file
diff --git a/app/components/model-form/text-input.js b/app/components/model-form/text-input.js
deleted file mode 100644
index 38d049b26..000000000
--- a/app/components/model-form/text-input.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import { none, alias } from '@ember/object/computed';
-import Component from '@ember/component';
-import { computed } from '@ember/object';
-
-export default Component.extend({
- classNames: ['mb-3'],
- classNameBindings: ['usesGrid:row'],
- inputLayout: null,
- usesGrid: none('inputLayout'),
- labelClass: 'col-sm-2',
- inputWrapperClass: 'col-sm-10',
- inputValidityClass: computed('isInvalid', function () {
- return this.isInvalid ? 'is-invalid' : '';
- }),
- type: 'text',
- model: null,
- label: null,
- property: null,
- disabled: false,
- required: false,
- inputGroup: false,
- isInvalid: computed('model.errors.[]', 'property', function () {
- return this.get(`model.errors.${this.property}.length`) > 0;
- }),
- inputIdentifier: computed(
- 'model.constructor.modelName',
- 'property',
- function () {
- // See http://stackoverflow.com/questions/34864580/ember-data-model-getmodelname-is-undefined-but-model-internalmodel-works
- // On why model.constructor.modelName is used instead of model.modelName
- return `${this.model.constructor.modelName}-form-${this.property}`;
- }
- ),
- placeholder: alias('label'),
-});
diff --git a/app/components/model-form/text-input.ts b/app/components/model-form/text-input.ts
new file mode 100644
index 000000000..cc225b363
--- /dev/null
+++ b/app/components/model-form/text-input.ts
@@ -0,0 +1,51 @@
+import Component from '@glimmer/component';
+import type Model from '@ember-data/model';
+
+export interface TextInputSignature
{
+ Args: {
+ inputLayout?: string;
+ labelClass?: string;
+ inputWrapperClass?: string;
+ model: T;
+ property: keyof T;
+ label: string;
+ };
+}
+
+export default class TextInput<
+ Signature extends TextInputSignature = TextInputSignature
+> extends Component {
+ get usesGrid() {
+ return typeof this.args.inputLayout === 'undefined';
+ }
+
+ get labelClass() {
+ return this.args.labelClass ?? 'col-sm-2';
+ }
+
+ get inputWrapperClass() {
+ return this.args.inputWrapperClass ?? 'col-sm-10';
+ }
+
+ get isInvalid() {
+ return (
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ this.args.model.get?.('errors')?.get(this.args.property as any)?.length >
+ 0
+ );
+ }
+
+ get inputValidityClass() {
+ return this.isInvalid ? 'is-invalid' : '';
+ }
+
+ get inputIdentifier() {
+ return `${(this.args.model.constructor as typeof Model).modelName}-form-${
+ this.args.property
+ }`;
+ }
+
+ get placeholder() {
+ return this.args.label;
+ }
+}
diff --git a/app/config/environment.d.ts b/app/config/environment.d.ts
new file mode 100644
index 000000000..89db548bd
--- /dev/null
+++ b/app/config/environment.d.ts
@@ -0,0 +1,16 @@
+export default config;
+
+/**
+ * Type declarations for
+ * import config from 'my-app/config/environment'
+ */
+declare const config: {
+ environment: string;
+ modulePrefix: string;
+ podModulePrefix: string;
+ locationType: 'history' | 'hash' | 'none' | 'auto';
+ rootURL: string;
+ APP: Record;
+
+ maxFilesize: number;
+};
diff --git a/app/controllers/activities/activity/edit.js b/app/controllers/activities/activity/edit.js
index cb61dead3..f1f2604b6 100644
--- a/app/controllers/activities/activity/edit.js
+++ b/app/controllers/activities/activity/edit.js
@@ -63,8 +63,8 @@ export default class ActivityEditController extends EditController {
}
@action
- coverPhotoLoaded(file) {
- this.model.set('coverPhoto', file.data);
+ coverPhotoLoaded(_file, data) {
+ this.model.set('coverPhoto', data);
}
@action
diff --git a/app/controllers/articles/article/edit.js b/app/controllers/articles/article/edit.js
index 6e8eed97b..2adc9c2c1 100644
--- a/app/controllers/articles/article/edit.js
+++ b/app/controllers/articles/article/edit.js
@@ -38,9 +38,9 @@ export default class ArticleEditController extends EditController {
}
@action
- coverPhotoLoaded(file) {
+ coverPhotoLoaded(_file, data) {
const article = this.model;
- article.set('coverPhoto', file.data);
+ article.set('coverPhoto', data);
}
@action
diff --git a/app/controllers/books/book/edit.js b/app/controllers/books/book/edit.js
index 781967f29..a80dcc289 100644
--- a/app/controllers/books/book/edit.js
+++ b/app/controllers/books/book/edit.js
@@ -15,9 +15,9 @@ export default class BookEditController extends EditController {
@tracked lookupIsbnError = false;
@action
- coverPhotoLoaded(file) {
+ coverPhotoLoaded(_file, data) {
const book = this.model;
- book.set('coverPhoto', file.data);
+ book.set('coverPhoto', data);
}
@action
diff --git a/app/controllers/debit/collections/new.js b/app/controllers/debit/collections/new.js
index d901118e3..08ecaddbe 100644
--- a/app/controllers/debit/collections/new.js
+++ b/app/controllers/debit/collections/new.js
@@ -19,8 +19,8 @@ export default class CollectionsNewController extends EditController {
validExtensions = EmberArray.apply(['csv', 'ods', 'xlsx', 'xlsm']);
@action
- fileLoaded(file) {
+ fileLoaded(_file, data) {
const collection = this.model;
- collection.importFile = file.data;
+ collection.importFile = data;
}
}
diff --git a/app/controllers/groups/group/edit.js b/app/controllers/groups/group/edit.js
index 6afb5cbe9..b6866ddf7 100644
--- a/app/controllers/groups/group/edit.js
+++ b/app/controllers/groups/group/edit.js
@@ -89,7 +89,7 @@ export default class GroupEditController extends EditController {
}
@action
- fileLoaded(file) {
- this.model.set('avatar', file.data);
+ fileLoaded(_file, data) {
+ this.model.set('avatar', data);
}
}
diff --git a/app/controllers/users/batch/new.js b/app/controllers/users/batch/new.js
index f8ac9aebc..0c8681a90 100644
--- a/app/controllers/users/batch/new.js
+++ b/app/controllers/users/batch/new.js
@@ -21,7 +21,7 @@ export default class BatchNewController extends NewController {
successTransitionTarget = 'users';
successTransitionModel = null;
- validMimetypes = EmberArray.apply([
+ validMimeTypes = EmberArray.apply([
'text/csv',
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
@@ -35,10 +35,10 @@ export default class BatchNewController extends NewController {
}
@action
- fileLoaded(file) {
+ fileLoaded(_file, data) {
this.newUsers.clear();
this.importErrors.clear();
- this.set('importFile', file.data);
+ this.set('importFile', data);
}
@action
diff --git a/app/controllers/users/user/edit/index.js b/app/controllers/users/user/edit/index.js
index 930bacfae..05d14075b 100644
--- a/app/controllers/users/user/edit/index.js
+++ b/app/controllers/users/user/edit/index.js
@@ -36,8 +36,8 @@ export default class EditIndexController extends EditController {
}
@action
- fileLoaded(file) {
+ fileLoaded(_file, data) {
const user = this.model;
- user.set('avatar', file.data);
+ user.set('avatar', data);
}
}
diff --git a/app/controllers/vacancies/vacancy/edit.js b/app/controllers/vacancies/vacancy/edit.js
index f30651fb6..005031a26 100644
--- a/app/controllers/vacancies/vacancy/edit.js
+++ b/app/controllers/vacancies/vacancy/edit.js
@@ -17,8 +17,8 @@ export default class VacancyEditController extends EditController {
}
@action
- coverPhotoLoaded(file) {
+ coverPhotoLoaded(_file, data) {
const vacancy = this.model;
- vacancy.set('coverPhoto', file.data);
+ vacancy.set('coverPhoto', data);
}
}
diff --git a/app/templates/debit/collections/new.hbs b/app/templates/debit/collections/new.hbs
index 6207afbfc..9029c2355 100644
--- a/app/templates/debit/collections/new.hbs
+++ b/app/templates/debit/collections/new.hbs
@@ -37,7 +37,7 @@
@label='Import bestand'
@loadedCallback={{action 'fileLoaded'}}
@validExtensions={{this.validExtensions}}
- @validMimetypes={{this.validMimetypes}}
+ @validMimeTypes={{this.validMimeTypes}}
/>