fix(person/publications): made URL stateful and moved retrieval logic to resolvers

This commit is contained in:
Mats Paul Tončik
2026-07-12 23:39:25 +02:00
parent 9cf6348f55
commit fa5e42a5eb
24 changed files with 1211 additions and 563 deletions
@@ -21,22 +21,23 @@
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>Publikationsliste</mat-panel-title>
<mat-panel-description>{{ total }} Publikationen</mat-panel-description>
<mat-panel-description
>{{ totalElements() }} Publikationen</mat-panel-description
>
</mat-expansion-panel-header>
<div class="publication-filter-stack">
<form class="publication-filters" [formGroup]="filterForm">
<form class="publication-filters">
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon"
>calendar_today</mat-icon
>
<mat-select
placeholder="Jahr"
formControlName="publicationYears"
multiple
[panelWidth]="null"
(selectionChange)="applyFilters()"
(selectionChange)="handleYearSelectionChange($event)"
(opened)="focusSelectSearch(yearSearchInput)"
(closed)="yearSearchControl.setValue('')">
[value]="this.selectedYearsQueryParams()">
<mat-select-trigger>{{
yearSelectionSummary()
}}</mat-select-trigger>
@@ -46,7 +47,6 @@
#yearSearchInput
type="text"
class="select-search__input"
[formControl]="yearSearchControl"
placeholder="Jahr suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@@ -62,12 +62,11 @@
<mat-icon matPrefix class="filter-prefix-icon">category</mat-icon>
<mat-select
placeholder="Typ"
formControlName="types"
multiple
[panelWidth]="null"
(selectionChange)="applyFilters()"
(selectionChange)="handleTypeSelectionChange($event)"
(opened)="focusSelectSearch(typeSearchInput)"
(closed)="typeSearchControl.setValue('')">
[value]="this.selectedTypesQueryParams()">
<mat-select-trigger>{{
typeSelectionSummary()
}}</mat-select-trigger>
@@ -93,12 +92,11 @@
<mat-icon matPrefix class="filter-prefix-icon">translate</mat-icon>
<mat-select
placeholder="Sprache"
formControlName="languages"
multiple
[panelWidth]="null"
(selectionChange)="applyFilters()"
(selectionChange)="handleLanguageSelectionChange($event)"
(opened)="focusSelectSearch(languageSearchInput)"
(closed)="languageSearchControl.setValue('')">
[value]="this.selectedLanguagesQueryParams()">
<mat-select-trigger>{{
languageSelectionSummary()
}}</mat-select-trigger>
@@ -185,21 +183,6 @@
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="sort-field">
<mat-icon matPrefix class="filter-prefix-icon">sort</mat-icon>
<mat-select
[formControl]="sortControl"
[panelWidth]="null"
aria-label="Sortierung"
(selectionChange)="onSortChange()">
@for (option of sortOptions; track option.value) {
<mat-option [value]="option.value">{{
option.label
}}</mat-option>
}
</mat-select>
</mat-form-field>
<button
class="reset-filter-btn"
mat-stroked-button
@@ -211,20 +194,17 @@
</button>
</form>
@let selectedYears = filterForm.controls.publicationYears.value;
@let selectedTypes = filterForm.controls.types.value;
@let selectedLanguages = filterForm.controls.languages.value;
@if (
selectedInstitutions.length ||
selectedTopics.length ||
selectedYears.length ||
selectedTypes.length ||
selectedLanguages.length
selectedInstitutionIdsQueryParams().length ||
selectedTopicIdsQueryParams().length ||
selectedYearsQueryParams().length ||
selectedTypesQueryParams().length ||
selectedLanguagesQueryParams().length
) {
<div class="active-filters-row" aria-label="Aktive Filter">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (year of selectedYears; track year) {
@for (year of selectedYearsQueryParams(); track year) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
@@ -241,7 +221,7 @@
</button>
</span>
}
@for (type of selectedTypes; track type) {
@for (type of selectedTypesQueryParams(); track type) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon">category</mat-icon>
@@ -256,14 +236,17 @@
</button>
</span>
}
@for (language of selectedLanguages; track language) {
@for (
language of selectedLanguagesQueryParams();
track language
) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>translate</mat-icon
>
<span class="filter-meta-chip__label">{{
languageLabel(language)
language | languageCode
}}</span>
</span>
<button
@@ -271,20 +254,20 @@
class="remove-chip-btn"
(click)="toggleLanguageFilter(language)"
[attr.aria-label]="
'Sprachfilter ' + languageLabel(language) + ' entfernen'
'Sprachfilter ' + (language | languageCode) + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics; track topic.id) {
@for (topic of selectedTopics(); track topic.id) {
<span class="active-meta-filter">
<span
class="filter-topic-chip"
[style.--topic-color]="getSelectedTopicColor(topic)"
[matTooltip]="getSelectedTopicTooltip(topic)"
[style.--topic-color]="getWorkTopicColor(topic)"
[matTooltip]="getSelectedWorkTopicTooltip(topic)"
matTooltipClass="topic-chip-tooltip"
[matTooltipDisabled]="!getSelectedTopicTooltip(topic)">
[matTooltipDisabled]="!getSelectedWorkTopicTooltip(topic)">
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
<span class="filter-topic-chip__label">{{
topic.display_name
@@ -301,7 +284,10 @@
</button>
</span>
}
@for (institution of selectedInstitutions; track institution.id) {
@for (
institution of selectedInstitutions();
track institution.id
) {
@let instCountry = selectedInstitutionCountry(institution);
<span class="active-institution-filter">
<span class="filter-institution-chip">
@@ -325,7 +311,10 @@
}
<mat-icon
class="institution-open-icon"
(click)="openInstitutionPage(institution.id, $event)"
[routerLink]="[
'/institution',
extractRawId(institution.id),
]"
aria-label="Institutionsseite öffnen"
>open_in_new</mat-icon
>
@@ -344,13 +333,16 @@
}
</div>
<app-data-table [columns]="workColumns" [data]="publications" />
<app-data-table
[columns]="workColumns"
[data]="elements()"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<app-query-param-paginator
[total]="total"
queryParamPageKey="publicationPage"
queryParamSizeKey="publicationPageSize"
[pageSizeOptions]="paginationService.options"
(handlePageChange)="onPage($event)" />
[total]="totalElements()"
queryParamPageKey="page"
queryParamSizeKey="size"
[pageSizeOptions]="paginationService.options" />
</mat-expansion-panel>
</mat-accordion>
</div>
@@ -398,11 +390,11 @@
<button
type="button"
class="cell-filter-pill"
[class.active]="isLanguageActive(work.language)"
[class.active]="isLanguageActive(work.language_code)"
matTooltip="Nach Sprache filtern"
matTooltipPosition="above"
(click)="toggleLanguageFilter(work.language)">
{{ work.language | languageCode }}
(click)="toggleLanguageFilter(work.language_code)">
{{ work.language_code | languageCode }}
</button>
} @else {
<span class="empty-text">-</span>
@@ -410,43 +402,49 @@
</ng-template>
<ng-template #institutionsTmp let-work>
@let publicationInstitutions = getInstitutions(work);
@let publicationInstitutions = work.institutions ?? [];
@let institutionsExpanded = true;
@let visibleInstitutions =
institutionsExpanded
? publicationInstitutions
: publicationInstitutions.slice(0, 3);
<div class="institution-tags" aria-label="Institutionen">
@for (institution of visibleInstitutions; track institution.id) {
<div
class="institution-tags"
aria-label="Institutionen"
style="padding: 0.5rem 0">
@for (
institution of visibleInstitutions;
track institution.institution_id
) {
<button
type="button"
class="publication-institution-tag"
[class.active]="isInstitutionActive(institution.id!)"
[matTooltip]="institution.display_name"
[class.active]="isInstitutionActive(institution.institution_id!)"
[matTooltip]="institution.institution_name"
matTooltipPosition="above"
[attr.aria-label]="
'Nach Institution ' + institution.display_name + ' filtern'
'Nach Institution ' + institution.institution_name + ' filtern'
"
(click)="
filterByInstitution({
id: institution.id!,
name: institution.display_name || '',
id: institution.institution_id!,
name: institution.institution_name || '',
})
">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{ institution.display_name }}</span>
@if (institution.country_code) {
<span class="institution-name">{{ institution.institution_name }}</span>
@if (institution.institution_country_code) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
institution.country_code.toLowerCase() +
institution.institution_country_code.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
institution.country_code.toUpperCase()
institution.institution_country_code.toUpperCase()
}}</span>
}
</button>
@@ -483,7 +481,7 @@
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getTopicColor(topic)"
[color]="getWorkTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActive(topic)"
(chipClick)="filterByTopic(topic)">
@@ -511,7 +509,7 @@
<a
mat-icon-button
color="primary"
[routerLink]="['/publication', publicationKey(work)]"
[routerLink]="['/publication', extractRawId(work.id)]"
matTooltip="Details anzeigen">
<mat-icon>open_in_new</mat-icon>
</a>
File diff suppressed because it is too large Load Diff