|
1 | | -<ng-container *ngIf="attachment"> |
| 1 | +@if (attachment) { |
2 | 2 | <div class="d-flex flex-row flex-wrap flex-lg-nowrap card-container mt-1 mb-3 gap-3" data-test="attachment-info"> |
3 | 3 |
|
4 | 4 | <div class="order-lg-1 thumbnail-wrapper"> |
|
7 | 7 |
|
8 | 8 | <div class="order-lg-3 ml-auto"> |
9 | 9 | <div class="d-flex flex-column align-items-end gap-3"> |
10 | | - <ng-container *ngFor="let renderingType of allAttachmentProviders"> |
| 10 | + @for (renderingType of allAttachmentProviders; track $index) { |
11 | 11 | <div class="text-nowrap"> |
12 | 12 | <ds-attachment-render [renderingType]="renderingType" [bitstream]="attachment" [item]="item" [tabName]="tabName"></ds-attachment-render> |
13 | 13 | </div> |
14 | | - </ng-container> |
| 14 | + } |
15 | 15 | <!-- Default download button --> |
16 | 16 | <div class="text-nowrap"> |
17 | 17 | <ds-attachment-render [renderingType]="AttachmentRenderingType.DOWNLOAD" [bitstream]="attachment" [item]="item" [tabName]="tabName"></ds-attachment-render> |
|
20 | 20 | </div> |
21 | 21 |
|
22 | 22 | <div class="order-lg-2 w-100 mb-3"> |
23 | | - <ng-container *ngFor="let attachmentConf of envMetadata"> |
| 23 | + @for (attachmentConf of envMetadata; track $index) { |
| 24 | + @if (attachment.firstMetadataValue(attachmentConf.name) || attachmentConf.type === AdvancedAttachmentElementType.Attribute) { |
| 25 | + <div class="content" [attr.data-test]="attachmentConf.name"> |
| 26 | + <strong>{{ 'cris-layout.advanced-attachment.' + attachmentConf.name | translate }}</strong> |
24 | 27 |
|
25 | | - <div class="content" |
26 | | - [attr.data-test]="attachmentConf.name" |
27 | | - *ngIf="attachment.firstMetadataValue(attachmentConf.name) || attachmentConf.type === AdvancedAttachmentElementType.Attribute" |
28 | | - > |
29 | | - <strong>{{ 'cris-layout.advanced-attachment.'+attachmentConf.name | translate }}</strong> |
| 28 | + @if (attachmentConf.type === AdvancedAttachmentElementType.Metadata) { |
30 | 29 |
|
31 | | - <ng-container *ngIf="attachmentConf.type === AdvancedAttachmentElementType.Metadata"> |
| 30 | + @if(!attachmentConf.truncatable && attachmentConf.name === attachmentTypeMetadata) { |
| 31 | + <p class="text-break m-0"> |
| 32 | + {{attachment.firstMetadataValue(attachmentConf.name) | titlecase}} |
| 33 | + </p> |
| 34 | + } |
32 | 35 |
|
33 | | - <p class="text-break m-0" *ngIf="!attachmentConf.truncatable && attachmentConf.name === attachmentTypeMetadata"> |
34 | | - {{attachment.firstMetadataValue(attachmentConf.name) | titlecase}} |
35 | | - </p> |
| 36 | + @if(!attachmentConf.truncatable && attachmentConf.name !== attachmentTypeMetadata) { |
| 37 | + <p class="text-break m-0"> |
| 38 | + {{attachment.firstMetadataValue(attachmentConf.name)}} |
| 39 | + </p> |
| 40 | + } |
36 | 41 |
|
37 | | - <p class="text-break m-0" *ngIf="!attachmentConf.truncatable && attachmentConf.name !== attachmentTypeMetadata"> |
38 | | - {{attachment.firstMetadataValue(attachmentConf.name)}} |
39 | | - </p> |
| 42 | + @if (attachmentConf.truncatable) { |
| 43 | + <ds-truncatable [id]=" attachment.id"> |
| 44 | + <ds-truncatable-part [id]="attachment.id" [minLines]="1"> |
| 45 | + {{attachment.firstMetadataValue(attachmentConf.name)}} |
| 46 | + </ds-truncatable-part> |
| 47 | + </ds-truncatable> |
| 48 | + } |
| 49 | + } |
| 50 | + @if (attachmentConf.type === AdvancedAttachmentElementType.Attribute) { |
| 51 | + @if (attachmentConf.name === 'format') { |
| 52 | + @if ((bitstreamFormat$ | async) === null || (bitstreamFormat$ | async) === undefined) { |
| 53 | + <p class="text-muted"> |
| 54 | + {{'cris-layout.advanced-attachment.label.not-present' | translate}} |
| 55 | + </p> |
| 56 | + } @else { |
| 57 | + <p class="word-break m-0">{{(bitstreamFormat$ | async)}}</p> |
| 58 | + } |
| 59 | + } |
40 | 60 |
|
41 | | - <ds-truncatable *ngIf="attachmentConf.truncatable" [id]=" attachment.id"> |
42 | | - <ds-truncatable-part [id]="attachment.id" [minLines]="1"> |
43 | | - {{attachment.firstMetadataValue(attachmentConf.name)}} |
44 | | - </ds-truncatable-part> |
45 | | - </ds-truncatable> |
| 61 | + @if (attachmentConf.name === 'size' && bitstreamSize) { |
| 62 | + <p class="word-break m-0">{{bitstreamSize | dsFileSize}}</p> |
| 63 | + } |
46 | 64 |
|
47 | | - </ng-container> |
| 65 | + @if (attachmentConf.name === 'checksum') { |
| 66 | + @if (checksumInfo?.value === null || checksumInfo?.value === undefined) { |
| 67 | + <p class="text-muted"> |
| 68 | + {{'cris-layout.advanced-attachment.label.not-present' | translate}} |
| 69 | + </p> |
| 70 | + } @else { |
| 71 | + <p class="word-break m-0">({{checksumInfo.checkSumAlgorithm}}):{{ checksumInfo.value }}</p> |
| 72 | + } |
| 73 | + } |
| 74 | + } |
48 | 75 |
|
49 | | - <ng-container *ngIf="attachmentConf.type === AdvancedAttachmentElementType.Attribute"> |
50 | | - <ng-container *ngIf="attachmentConf.name === 'format'"> |
51 | | - <p *ngIf="(getFormat(attachment) | async) === null || (getFormat(attachment) | async) === undefined" class="text-muted"> |
52 | | - {{'cris-layout.advanced-attachment.label.not-present' | translate}} |
53 | | - </p> |
54 | | - <p class="word-break m-0">{{getFormat(attachment) | async}}</p> |
55 | | - </ng-container> |
56 | | - |
57 | | - <ng-container *ngIf="attachmentConf.name === 'size'"> |
58 | | - <p class="word-break m-0">{{getSize(attachment) | dsFileSize}}</p> |
59 | | - </ng-container> |
60 | | - |
61 | | - <ng-container *ngIf="attachmentConf.name === 'checksum'"> |
62 | | - <p *ngIf="(getChecksum(attachment)?.value) !== true"class="text-muted"> |
63 | | - {{'cris-layout.advanced-attachment.label.not-present' | translate}} |
64 | | - </p> |
65 | | - <p class="word-break m-0">({{getChecksum(attachment).checkSumAlgorithm}}):{{ getChecksum(attachment).value }}</p> |
66 | | - </ng-container> |
67 | | - </ng-container> |
68 | | - |
69 | | - </div> |
70 | | - </ng-container> |
| 76 | + </div> |
| 77 | + } |
| 78 | + } |
71 | 79 |
|
72 | 80 | </div> |
73 | 81 |
|
74 | 82 | </div> |
75 | | -</ng-container> |
| 83 | +} |
0 commit comments