Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix principal form component positioning and styling of errors

Oliver Günther4a0cf2f2eab2
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 61302916e0b..e9c22773cec 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -1272,7 +1272,7 @@ en:
message:
label: 'Invitation message'
- description: 'We will send an email to the user, to which you can add a personal message here. An explanation for the invitation could be useful, or prehaps a bit of information regarding the rpoject to help them get started.'
+ description: 'We will send an email to the user, to which you can add a personal message here. An explanation for the invitation could be useful, or prehaps a bit of information regarding the project to help them get started.'
next_button: 'Next'
summary:
diff --git a/frontend/src/app/features/invite-user-modal/principal/principal-search.component.html b/frontend/src/app/features/invite-user-modal/principal/principal-search.component.html
index 455aaf0546c..01fc643308b 100644
--- a/frontend/src/app/features/invite-user-modal/principal/principal-search.component.html
+++ b/frontend/src/app/features/invite-user-modal/principal/principal-search.component.html
@@ -1,6 +1,6 @@
<ng-select
appendTo=".spot-modal-overlay"
- [formControl]="principalControl"
+ [formControl]="spotFormBinding"
[addTag]="showAddTag ? createNewFromInput.bind(this) : false"
[typeahead]="input$"
[items]="items$ | async"
diff --git a/frontend/src/app/features/invite-user-modal/principal/principal-search.component.ts b/frontend/src/app/features/invite-user-modal/principal/principal-search.component.ts
index 572e0d2a5dc..5b71dedd737 100644
--- a/frontend/src/app/features/invite-user-modal/principal/principal-search.component.ts
+++ b/frontend/src/app/features/invite-user-modal/principal/principal-search.component.ts
@@ -42,7 +42,7 @@ interface NgSelectPrincipalOption {
templateUrl: './principal-search.component.html',
})
export class PrincipalSearchComponent extends UntilDestroyedMixin implements OnInit {
- @Input('spotFormBinding') principalControl:FormControl;
+ @Input() spotFormBinding:FormControl;
@Input() type:PrincipalType;
diff --git a/frontend/src/app/features/invite-user-modal/principal/principal.component.html b/frontend/src/app/features/invite-user-modal/principal/principal.component.html
index 4b42630c9be..9809ae3dfcf 100644
--- a/frontend/src/app/features/invite-user-modal/principal/principal.component.html
+++ b/frontend/src/app/features/invite-user-modal/principal/principal.component.html
@@ -77,7 +77,7 @@
<div
slot="errors"
- class="op-form-field--error"
+ class="spot-form-field--error"
*ngIf="roleControl?.invalid"
>
{{ text.role.required }}
@@ -96,7 +96,7 @@
#input>
</textarea>
- <p class="op-form-field--description" slot="help-text">
+ <p class="op-form-field--description" slot="description">
{{ text.message.description() }}
</p>
</op-form-field>
diff --git a/frontend/src/app/spot/components/form-field/form-binding.directive.ts b/frontend/src/app/spot/components/form-field/form-binding.directive.ts
index 1120c707b14..5625b35a624 100644
--- a/frontend/src/app/spot/components/form-field/form-binding.directive.ts
+++ b/frontend/src/app/spot/components/form-field/form-binding.directive.ts
@@ -3,8 +3,9 @@ import {
FormArray, FormControl, FormGroup, NgControl,
} from '@angular/forms';
-export const formControlBinding:any = {
+export const formControlBinding = {
provide: NgControl,
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
useExisting: forwardRef(() => SpotFormBindingDirective),
};
diff --git a/frontend/src/app/spot/components/form-field/form-field.component.html b/frontend/src/app/spot/components/form-field/form-field.component.html
index 3c6565a4c61..19e236e8b4d 100644
--- a/frontend/src/app/spot/components/form-field/form-field.component.html
+++ b/frontend/src/app/spot/components/form-field/form-field.component.html
@@ -27,10 +27,6 @@
<ng-container *ngTemplateOutlet="inputTemplate"></ng-container>
</ng-container>
- <div class="spot-form-field--help-text">
- <ng-content select="[slot=help-text]"></ng-content>
- </div>
-
<div
class="spot-form-field--errors"
*ngIf="showErrorMessage"
@@ -38,6 +34,10 @@
>
<ng-content select="[slot=errors]"></ng-content>
</div>
+
+ <div class="spot-form-field--help-text">
+ <ng-content select="[slot=help-text]"></ng-content>
+ </div>
</ng-container>
<ng-template #inputTemplate>
diff --git a/frontend/src/app/spot/components/form-field/form-field.component.ts b/frontend/src/app/spot/components/form-field/form-field.component.ts
index 523dc562f29..512bdff8626 100644
--- a/frontend/src/app/spot/components/form-field/form-field.component.ts
+++ b/frontend/src/app/spot/components/form-field/form-field.component.ts
@@ -4,6 +4,7 @@ import {
import { AbstractControl, FormGroupDirective, NgControl } from '@angular/forms';
import { I18nService } from 'core-app/core/i18n/i18n.service';
+/* eslint-disable-next-line change-detection-strategy/on-push */
@Component({
selector: 'spot-form-field',
templateUrl: './form-field.component.html',
@@ -11,7 +12,7 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';
export class SpotFormFieldComponent {
@HostBinding('class.spot-form-field') className = true;
- @HostBinding('class.spot-form-field_invalid') get errorClassName() {
+ @HostBinding('class.spot-form-field_invalid') get errorClassName():boolean {
return this.showErrorMessage;
}
@@ -39,15 +40,15 @@ export class SpotFormFieldComponent {
invalid: this.I18n.t('js.label_invalid'),
};
- get errorsID() {
+ get errorsID():string {
return `${this.internalID}-errors`;
}
- get descriptionID() {
+ get descriptionID():string {
return `${this.internalID}-description`;
}
- get describedByID() {
+ get describedByID():string {
return this.showErrorMessage ? this.errorsID : this.descriptionID;
}
diff --git a/frontend/src/app/spot/spot-docs.component.ts b/frontend/src/app/spot/spot-docs.component.ts
index 5b5b2a9b56c..1b576c95e2c 100644
--- a/frontend/src/app/spot/spot-docs.component.ts
+++ b/frontend/src/app/spot/spot-docs.component.ts
@@ -1,6 +1,7 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
+/* eslint-disable-next-line change-detection-strategy/on-push */
@Component({
selector: 'spot-docs',
templateUrl: './spot-docs.component.html',
@@ -18,6 +19,7 @@ export class SpotDocsComponent {
usernameForm = new FormGroup({
username: new FormControl('', [
+ /* eslint-disable-next-line @typescript-eslint/unbound-method */
Validators.required,
Validators.minLength(3),
Validators.maxLength(5),
@@ -38,11 +40,12 @@ export class SpotDocsComponent {
{ value: 3, title: '3' },
];
- onRemoveChip() {
+ onRemoveChip():void {
+ /* eslint-disable-next-line no-alert */
alert('Remove chip');
}
- checkboxValueString() {
+ checkboxValueString():string {
if (this.checkboxValue === null) {
return 'null (indeterminate)';
}
@@ -54,7 +57,8 @@ export class SpotDocsComponent {
return 'false (unchecked)';
}
- onUsernameSubmit() {
+ onUsernameSubmit():void {
+ /* eslint-disable-next-line no-alert */
alert(this.usernameForm.get('username')?.value);
}
}