-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correctly display validation errors for "photo" form field (#2717)
fixes #2713
- Loading branch information
Showing
3 changed files
with
59 additions
and
39 deletions.
There are no files selected for viewing
85 changes: 48 additions & 37 deletions
85
src/app/features/file/edit-photo/edit-photo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,52 @@ | ||
<img [src]="imgPath" alt="Image" class="image" (click)="openPopup()" /> | ||
<div class="photo-container"> | ||
<img [src]="imgPath" alt="Image" class="image" (click)="openPopup()" /> | ||
|
||
<div | ||
class="img-controls" | ||
[matTooltipDisabled]="!(formControl.enabled && !navigator.onLine)" | ||
matTooltip="Changes to files are not possible offline." | ||
i18n-matTooltip | ||
> | ||
<label class="img-label">{{ label }}</label> | ||
|
||
<button | ||
*ngIf="formControl.value && formControl.enabled" | ||
type="button" | ||
mat-icon-button | ||
(click)="delete()" | ||
i18n-mattooltip="Tooltip remove file" | ||
matTooltip="Remove file" | ||
[disabled]="!navigator.onLine" | ||
> | ||
<fa-icon icon="xmark"></fa-icon> | ||
</button> | ||
<button | ||
*ngIf="formControl.enabled" | ||
type="button" | ||
mat-icon-button | ||
(click)="fileUpload.click()" | ||
i18n-matTooltip="Tooltip upload file button" | ||
matTooltip="Upload file" | ||
[disabled]="!navigator.onLine" | ||
<div | ||
class="img-controls" | ||
[matTooltipDisabled]="!(formControl.enabled && !navigator.onLine)" | ||
matTooltip="Changes to files are not possible offline." | ||
i18n-matTooltip | ||
> | ||
<fa-icon icon="upload"></fa-icon> | ||
</button> | ||
<label | ||
class="img-label" | ||
[ngClass]="{ invalid: formControl.invalid && formControl.touched }" | ||
>{{ label }}</label | ||
> | ||
|
||
<button | ||
*ngIf="formControl.value && formControl.enabled" | ||
type="button" | ||
mat-icon-button | ||
(click)="delete()" | ||
i18n-matTooltip="Tooltip remove file" | ||
matTooltip="Remove file" | ||
[disabled]="!navigator.onLine" | ||
> | ||
<fa-icon icon="xmark"></fa-icon> | ||
</button> | ||
<button | ||
*ngIf="formControl.enabled" | ||
type="button" | ||
mat-icon-button | ||
(click)="fileUpload.click()" | ||
i18n-matTooltip="Tooltip upload file button" | ||
matTooltip="Upload file" | ||
[disabled]="!navigator.onLine" | ||
> | ||
<fa-icon icon="upload"></fa-icon> | ||
</button> | ||
|
||
<input | ||
type="file" | ||
style="display: none" | ||
(change)="onFileSelected($event.target['files'][0])" | ||
[accept]="acceptedFileTypes" | ||
#fileUpload | ||
/> | ||
<input | ||
type="file" | ||
style="display: none" | ||
(change)="onFileSelected($event.target['files'][0])" | ||
[accept]="acceptedFileTypes" | ||
#fileUpload | ||
/> | ||
</div> | ||
@if (formControl.invalid && formControl.touched) { | ||
<mat-error> | ||
<app-error-hint [form]="formControl"></app-error-hint> | ||
</mat-error> | ||
} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters