added expandible toggle to associated institutions

This commit is contained in:
Kazgatari
2026-08-18 20:02:12 +02:00
parent 24cc476dbe
commit 6c20dc2b58
2 changed files with 26 additions and 1 deletions
@@ -138,7 +138,7 @@
</h4>
<div class="associated-chips-container">
@for (
assoc of associatedInstitutions();
assoc of visibleAssociatedInstitutions();
track assoc.id ?? assoc.display_name
) {
<div class="associated-chip-wrapper">
@@ -150,6 +150,15 @@
(handleChipClick)="navigateToInstitution(assoc)" />
</div>
}
@if (hasMoreAssociated()) {
<button mat-button class="expand-btn" (click)="toggleAssociated()">
{{
showAllAssociated()
? 'Weniger anzeigen'
: '+' + (associatedInstitutions().length - 10) + ' weitere'
}}
</button>
}
</div>
</div>
}
@@ -169,6 +169,18 @@ export class InstitutionOverviewComponent {
return this.institution().associated_institutions ?? [];
});
showAllAssociated = signal<boolean>(false);
visibleAssociatedInstitutions = computed(() => {
const list = this.associatedInstitutions();
if (this.showAllAssociated()) return list;
return list.slice(0, 10);
});
hasMoreAssociated = computed(() => {
return this.associatedInstitutions().length > 10;
});
homepageUrl = computed(() => this.institution().homepage_url);
rorUrl = computed(() => this.institution().ror);
@@ -176,6 +188,10 @@ export class InstitutionOverviewComponent {
this.showAllAlternatives.update((v) => !v);
}
toggleAssociated(): void {
this.showAllAssociated.update((v) => !v);
}
navigateToInstitution(assoc: DehydratedInstitution): void {
const cleanId = this.stripOpenAlexId(assoc.id);
if (cleanId) {