pulbication overview: Make institution field expandable
This commit is contained in:
@@ -177,12 +177,19 @@
|
||||
|
||||
<div class="table-wrap">
|
||||
@if (loading) {
|
||||
<div class="loading">
|
||||
<div class="table-status">
|
||||
<mat-spinner diameter="36"></mat-spinner>
|
||||
<span>Publikationen werden geladen …</span>
|
||||
</div>
|
||||
} @else if (publications.length === 0) {
|
||||
<div class="table-status empty-state">Keine Publikationen gefunden.</div>
|
||||
}
|
||||
|
||||
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
|
||||
<table
|
||||
mat-table
|
||||
[dataSource]="publications"
|
||||
class="mat-elevation-z2"
|
||||
[class.is-hidden]="loading || publications.length === 0">
|
||||
<ng-container matColumnDef="title">
|
||||
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
@@ -257,11 +264,13 @@
|
||||
<th mat-header-cell *matHeaderCellDef>Institutionen</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
@let publicationInstitutions = institutions(publication);
|
||||
@let institutionsExpanded = isInstitutionsExpanded(publication);
|
||||
@let visibleInstitutions =
|
||||
institutionsExpanded
|
||||
? publicationInstitutions
|
||||
: publicationInstitutions.slice(0, 3);
|
||||
<div class="institution-tags" aria-label="Institutionen">
|
||||
@for (
|
||||
institution of publicationInstitutions.slice(0, 3);
|
||||
track institution.id
|
||||
) {
|
||||
@for (institution of visibleInstitutions; track institution.id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
@@ -293,9 +302,17 @@
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (publicationInstitutions.length > 3) {
|
||||
<span class="publication-institution-more">
|
||||
+{{ publicationInstitutions.length - 3 }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="institutionsExpanded"
|
||||
(click)="toggleInstitutions(publication)">
|
||||
{{
|
||||
institutionsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (publicationInstitutions.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
@@ -312,8 +329,11 @@
|
||||
<th mat-header-cell *matHeaderCellDef>Themen</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
@let publicationTopics = publication.topics ?? [];
|
||||
@let topicsExpanded = isTopicsExpanded(publication);
|
||||
@let visibleTopics =
|
||||
topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3);
|
||||
<div class="topic-chips" aria-label="Themen">
|
||||
@for (topic of publicationTopics.slice(0, 3); track topic.id) {
|
||||
@for (topic of visibleTopics; track topic.id) {
|
||||
<app-topic-chip
|
||||
size="mini"
|
||||
[label]="topic.display_name || ''"
|
||||
@@ -330,9 +350,17 @@
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (publicationTopics.length > 3) {
|
||||
<span class="publication-topic-more">
|
||||
+{{ publicationTopics.length - 3 }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="publication-topic-more"
|
||||
[attr.aria-expanded]="topicsExpanded"
|
||||
(click)="toggleTopics(publication)">
|
||||
{{
|
||||
topicsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (publicationTopics.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
@@ -341,10 +369,6 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
|
||||
@if (!loading && publications.length === 0) {
|
||||
<div class="empty-state">Keine Publikationen gefunden.</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-footer">
|
||||
|
||||
Reference in New Issue
Block a user