added expandible toggle to associated institutions
This commit is contained in:
+10
-1
@@ -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>
|
||||
}
|
||||
|
||||
+16
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user