Skip to content

Commit d478340

Browse files
Merge branch 'w2p-141473_fix-irregular-whitespace-for-MetadataRepresentationListComponent_contribute-9.0' into w2p-141473_fix-irregular-whitespace-for-MetadataRepresentationListComponent_contribute-main
2 parents 7d563aa + 43e4184 commit d478340

3 files changed

Lines changed: 35 additions & 18 deletions

File tree

src/app/item-page/simple/metadata-representation-list/metadata-representation-list.component.html

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
<ds-metadata-field-wrapper [label]="label">
2-
@for (objectPage of objects; track objectPage; let i = $index) {
2+
@for (objectPage of objects; track objectPage; let i = $index; let lastPage = $last) {
33
<ng-container *ngVar="(objectPage | async) as representations">
4-
@for (rep of representations; track rep) {
4+
@for (rep of representations; track rep; let last = $last) {
55
<ds-metadata-representation-loader
66
[mdRepresentation]="rep">
77
</ds-metadata-representation-loader>
8+
@if (!last || !lastPage) {
9+
<span [innerHTML]="separator"></span>
10+
}
811
}
9-
@if ((i + 1) === objects.length && (i > 0) && (!representations || representations?.length === 0)) {
12+
@if (lastPage && (i > 0) && (!representations || representations?.length === 0)) {
1013
<ds-loading message="{{'loading.default' | translate}}"></ds-loading>
1114
}
12-
@if ((i + 1) === objects.length && representations?.length > 0) {
13-
<div class="d-inline-block w-100 mt-2">
14-
@if ((objects.length * incrementBy) < total) {
15-
<div class="float-start">
16-
<button class="btn btn-link btn-link-inline" (click)="increase()">{{'item.page.related-items.view-more' |
17-
translate:{ amount: (total - (objects.length * incrementBy) < incrementBy) ? total - (objects.length * incrementBy) : incrementBy } }}</button>
18-
</div>
19-
}
20-
@if (objects.length > 1) {
21-
<div class="float-end">
22-
<button class="btn btn-link btn-link-inline" (click)="decrease()">{{'item.page.related-items.view-less' |
23-
translate:{ amount: representations?.length } }}</button>
24-
</div>
25-
}
15+
@if (lastPage && representations?.length > 0 && ((objects.length * incrementBy) < total || objects.length > 1)) {
16+
<div class="d-flex justify-content-between w-100 mt-2">
17+
<div>
18+
@if ((objects.length * incrementBy) < total) {
19+
<button class="btn btn-link btn-link-inline" (click)="increase()">{{'item.page.related-items.view-more' |
20+
translate:{ amount: (total - (objects.length * incrementBy) < incrementBy) ? total - (objects.length * incrementBy) : incrementBy } }}</button>
21+
}
22+
</div>
23+
<div>
24+
@if (objects.length > 1) {
25+
<button class="btn btn-link btn-link-inline" (click)="decrease()">{{'item.page.related-items.view-less' |
26+
translate:{ amount: representations?.length } }}</button>
27+
}
28+
</div>
2629
</div>
2730
}
2831
</ng-container>

src/app/item-page/simple/metadata-representation-list/metadata-representation-list.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export class MetadataRepresentationListComponent extends AbstractIncrementalList
7171
*/
7272
@Input() incrementBy = 10;
7373

74+
/**
75+
* The separator used to split the metadata values (can contain HTML)
76+
*/
77+
@Input() separator = '<br>';
78+
7479
/**
7580
* The total amount of metadata values available
7681
*/

src/app/item-page/simple/metadata-representation-list/themed-metadata-representation-list.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ import { MetadataRepresentationListComponent } from './metadata-representation-l
1212
templateUrl: '../../../shared/theme-support/themed.component.html',
1313
})
1414
export class ThemedMetadataRepresentationListComponent extends ThemedComponent<MetadataRepresentationListComponent> {
15-
protected inAndOutputNames: (keyof MetadataRepresentationListComponent & keyof this)[] = ['parentItem', 'itemType', 'metadataFields', 'label', 'incrementBy'];
15+
protected inAndOutputNames: (keyof MetadataRepresentationListComponent & keyof this)[] = [
16+
'parentItem',
17+
'itemType',
18+
'metadataFields',
19+
'label',
20+
'incrementBy',
21+
'separator',
22+
];
1623

1724
@Input() parentItem: Item;
1825

@@ -24,6 +31,8 @@ export class ThemedMetadataRepresentationListComponent extends ThemedComponent<M
2431

2532
@Input() incrementBy: number;
2633

34+
@Input() separator: string;
35+
2736
protected getComponentName(): string {
2837
return 'MetadataRepresentationListComponent';
2938
}

0 commit comments

Comments
 (0)