|
3 | 3 | <ion-item class="ion-text-wrap"> |
4 | 4 | <ion-label> |
5 | 5 | <p class="item-heading">{{ title }} <span [core-mark-required]="required" class="core-mark-required"></span></p> |
6 | | - <span *ngIf="maxSubmissionsReadable"> |
7 | | - {{ 'core.maxsizeandattachments' | translate:{$a: {size: maxSizeReadable, attachments: maxSubmissionsReadable} } }} |
| 6 | + <span> |
| 7 | + @if (maxSubmissionsReadable) { |
| 8 | + {{ 'core.maxsizeandattachments' | translate:{$a: {size: maxSizeReadable, attachments: maxSubmissionsReadable} } }} |
| 9 | + } @else { |
| 10 | + {{ 'core.maxfilesize' | translate:{$a: maxSizeReadable} }} |
| 11 | + } |
8 | 12 | </span> |
9 | | - <span *ngIf="!maxSubmissionsReadable">{{ 'core.maxfilesize' | translate:{$a: maxSizeReadable} }}</span> |
10 | 13 | </ion-label> |
11 | | - <ion-button slot="end" (click)="add()" [ariaLabel]="'core.fileuploader.addfiletext' | translate" |
12 | | - *ngIf="unlimitedFiles || (maxSubmissions !== undefined && maxSubmissions >= 0 && files && files.length < maxSubmissions)"> |
13 | | - <ion-icon name="fas-plus" slot="icon-only" aria-hidden="true" /> |
14 | | - </ion-button> |
| 14 | + @if (unlimitedFiles || (maxSubmissions !== undefined && maxSubmissions >= 0 && files && files.length < maxSubmissions)) { |
| 15 | + <ion-button slot="end" (click)="add()" [ariaLabel]="'core.fileuploader.addfiletext' | translate"> |
| 16 | + <ion-icon name="fas-plus" slot="icon-only" aria-hidden="true" /> |
| 17 | + </ion-button> |
| 18 | + } |
15 | 19 | </ion-item> |
16 | 20 |
|
17 | 21 | @if (fileTypes && fileTypes.mimetypes && fileTypes.mimetypes.length) { |
|
25 | 29 | </ion-item> |
26 | 30 |
|
27 | 31 | <ul class="core-attachments" slot="content"> |
28 | | - <li *ngFor="let typeInfo of fileTypes.info"> |
29 | | - <strong *ngIf="typeInfo.name">{{typeInfo.name}} </strong>{{typeInfo.extlist}} |
30 | | - </li> |
| 32 | + @for (typeInfo of fileTypes.info; track typeInfo.name) { |
| 33 | + <li> |
| 34 | + @if (typeInfo.name) { |
| 35 | + <strong>{{typeInfo.name}} </strong> |
| 36 | + } |
| 37 | + {{typeInfo.extlist}} |
| 38 | + </li> |
| 39 | + } |
31 | 40 | </ul> |
32 | 41 | </ion-accordion> |
33 | 42 | </ion-accordion-group> |
34 | 43 | } |
35 | 44 |
|
36 | | - |
37 | | - |
38 | 45 | <ng-container *ngFor="let file of files; let index=index"> |
39 | | - <!-- Files already attached to the submission, either in online or in offline. --> |
40 | | - <core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="componentId" [canDelete]="true" |
41 | | - (onDelete)="delete(index, true)" [canDownload]="!file.offline" /> |
42 | | - |
43 | | - <!-- Files added to draft but not attached to submission yet. --> |
44 | | - <core-local-file *ngIf="file.name" [file]="file" [manage]="true" (onDelete)="delete(index, false)" |
45 | | - (onRename)="renamed(index, $event)" /> |
| 46 | + @if (file.name) { |
| 47 | + <!-- Files added to draft but not attached to submission yet. --> |
| 48 | + <core-local-file [file]="file" [manage]="true" (onDelete)="delete(index, false)" (onRename)="renamed(index, $event)" /> |
| 49 | + } @else { |
| 50 | + <!-- Files already attached to the submission, either in online or in offline. --> |
| 51 | + <core-file [file]="file" [component]="component" [componentId]="componentId" [canDelete]="true" |
| 52 | + (onDelete)="delete(index, true)" [canDownload]="!file.offline" /> |
| 53 | + } |
46 | 54 | </ng-container> |
47 | 55 |
|
48 | | - <ion-item class="ion-text-wrap" *ngIf="!files || !files.length"> |
49 | | - <ion-label> |
50 | | - <p>{{ 'core.fileuploader.nofilesattached' | translate }}</p> |
51 | | - </ion-label> |
52 | | - </ion-item> |
| 56 | + @if (!files || !files.length) { |
| 57 | + <ion-item class="ion-text-wrap"> |
| 58 | + <ion-label> |
| 59 | + <p>{{ 'core.fileuploader.nofilesattached' | translate }}</p> |
| 60 | + </ion-label> |
| 61 | + </ion-item> |
| 62 | + } |
53 | 63 | </ion-card> |
54 | 64 | </core-loading> |
0 commit comments