publication-detail: make authors and institutions collapsible like news sidebar
This commit is contained in:
@@ -117,55 +117,75 @@
|
||||
</section>
|
||||
}
|
||||
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="authorsExpanded = !authorsExpanded"
|
||||
[attr.aria-expanded]="authorsExpanded">
|
||||
<mat-icon>group</mat-icon>
|
||||
<h2>Autorinnen und Autoren</h2>
|
||||
<span>{{ authors().length }}</span>
|
||||
</div>
|
||||
<div class="author-list">
|
||||
@for (authorship of authors(); track authorship.author?.id) {
|
||||
<article>
|
||||
<div class="avatar">
|
||||
{{
|
||||
(
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'?'
|
||||
).charAt(0)
|
||||
}}
|
||||
</div>
|
||||
<div>
|
||||
@if (authorship.author?.id; as authorId) {
|
||||
<a
|
||||
[routerLink]="[
|
||||
'/person',
|
||||
authorId.split('/').pop(),
|
||||
'overview',
|
||||
]">
|
||||
{{
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'Unbekannt'
|
||||
}}
|
||||
</a>
|
||||
} @else {
|
||||
<strong>{{
|
||||
authorship.raw_author_name || 'Unbekannt'
|
||||
}}</strong>
|
||||
}
|
||||
<p>
|
||||
{{ authorship.author_position || 'Mitautor/in' }}
|
||||
@if (authorship.is_corresponding) {
|
||||
· Korrespondenz
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
} @empty {
|
||||
<p class="empty">Keine Angaben vorhanden.</p>
|
||||
<span class="accordion-title">Autorinnen und Autoren</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Autorinnen und Autoren dieser Publikation. Klicke auf eine Person, um zu ihrem Profil zu gelangen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
@if (authors().length) {
|
||||
<span class="count-badge">{{ authors().length }}</span>
|
||||
}
|
||||
</div>
|
||||
<mat-icon class="chevron" [class.rotated]="!authorsExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (authorsExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="author-list">
|
||||
@for (authorship of authors(); track authorship.author?.id) {
|
||||
<article>
|
||||
<div class="avatar">
|
||||
{{
|
||||
(
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'?'
|
||||
).charAt(0)
|
||||
}}
|
||||
</div>
|
||||
<div>
|
||||
@if (authorship.author?.id; as authorId) {
|
||||
<a
|
||||
[routerLink]="[
|
||||
'/person',
|
||||
authorId.split('/').pop(),
|
||||
'overview',
|
||||
]">
|
||||
{{
|
||||
authorship.author?.display_name ||
|
||||
authorship.raw_author_name ||
|
||||
'Unbekannt'
|
||||
}}
|
||||
</a>
|
||||
} @else {
|
||||
<strong>{{
|
||||
authorship.raw_author_name || 'Unbekannt'
|
||||
}}</strong>
|
||||
}
|
||||
<p>
|
||||
{{ authorship.author_position || 'Mitautor/in' }}
|
||||
@if (authorship.is_corresponding) {
|
||||
· Korrespondenz
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
} @empty {
|
||||
<p class="empty">Keine Angaben vorhanden.</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
|
||||
@if (publication.topics?.length) {
|
||||
@@ -300,41 +320,60 @@
|
||||
</section>
|
||||
|
||||
@if (institutions().length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
<section class="card accordion-card">
|
||||
<button
|
||||
type="button"
|
||||
class="accordion-header"
|
||||
(click)="institutionsExpanded = !institutionsExpanded"
|
||||
[attr.aria-expanded]="institutionsExpanded">
|
||||
<mat-icon>account_balance</mat-icon>
|
||||
<h2>Institutionen</h2>
|
||||
</div>
|
||||
<div class="compact-list">
|
||||
@for (institution of institutions(); track institution.id) {
|
||||
<div>
|
||||
<a
|
||||
class="institution-link"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
institution.id.split('/').pop() ?? '',
|
||||
]">
|
||||
{{ institution.name }}
|
||||
</a>
|
||||
@if (institution.country) {
|
||||
<span class="institution-country">
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="14" />
|
||||
{{ institution.country.toUpperCase() }}
|
||||
</span>
|
||||
} @else if (institution.type) {
|
||||
<span>{{ institution.type }}</span>
|
||||
<span class="accordion-title">Institutionen</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Institutionen, denen die Autorinnen und Autoren angehören. Klicke auf eine Institution, um zu ihrer Seite zu gelangen."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
>info_outline</mat-icon
|
||||
>
|
||||
<span class="count-badge">{{ institutions().length }}</span>
|
||||
<mat-icon class="chevron" [class.rotated]="!institutionsExpanded"
|
||||
>expand_more</mat-icon
|
||||
>
|
||||
</button>
|
||||
@if (institutionsExpanded) {
|
||||
<div class="accordion-body">
|
||||
<div class="compact-list">
|
||||
@for (institution of institutions(); track institution.id) {
|
||||
<div>
|
||||
<a
|
||||
class="institution-link"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
institution.id.split('/').pop() ?? '',
|
||||
]">
|
||||
{{ institution.name }}
|
||||
</a>
|
||||
@if (institution.country) {
|
||||
<span class="institution-country">
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="14" />
|
||||
{{ institution.country.toUpperCase() }}
|
||||
</span>
|
||||
} @else if (institution.type) {
|
||||
<span>{{ institution.type }}</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,79 @@ aside {
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
|
||||
.accordion-card {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 18px 22px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
font-family: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text);
|
||||
transition: background 0.12s;
|
||||
|
||||
&:hover {
|
||||
background: #f6f9ff;
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
flex-shrink: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
padding: 2px 7px;
|
||||
border-radius: 999px;
|
||||
background: #e8effe;
|
||||
color: #3b5bd6;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
flex-shrink: 0;
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
font-size: 16px !important;
|
||||
color: var(--sg-text-muted);
|
||||
opacity: 0.7;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.chevron {
|
||||
transition: transform 0.2s ease;
|
||||
|
||||
&.rotated {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: 4px 22px 22px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -445,6 +518,18 @@ dd {
|
||||
padding: 22px 20px;
|
||||
}
|
||||
|
||||
.accordion-card {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: 4px 20px 20px;
|
||||
}
|
||||
|
||||
.metrics,
|
||||
.author-list {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
import {
|
||||
@@ -38,6 +39,7 @@ interface InstitutionDetail {
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTooltipModule,
|
||||
RouterLink,
|
||||
TopicChipComponent,
|
||||
UpperCasePipe,
|
||||
@@ -57,6 +59,9 @@ export class PublicationDetailComponent implements OnInit {
|
||||
loading = true;
|
||||
notFound = false;
|
||||
|
||||
authorsExpanded = true;
|
||||
institutionsExpanded = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loading = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user