Merge pull request 'feat(funding): show publication titles and improve UI' (#114) from ts-86-get-funding-by-author-clean into dev
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
Reviewed-on: #114
This commit was merged in pull request #114.
This commit is contained in:
@@ -290,6 +290,7 @@ def _collect_funders_from_publications(
|
||||
"unknown": [],
|
||||
},
|
||||
"publication_urls": {},
|
||||
"publication_titles": {},
|
||||
}
|
||||
|
||||
entry = funder_counts[key]
|
||||
@@ -298,3 +299,7 @@ def _collect_funders_from_publications(
|
||||
entry["publication_ids"][author_position].append(publication_id)
|
||||
if publication_id and publication_url:
|
||||
entry["publication_urls"][publication_id] = publication_url
|
||||
if publication_id:
|
||||
title = publication.get("display_name") or publication.get("title") or publication_id
|
||||
entry["publication_titles"][publication_id] = title
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class FunderByAuthor(BaseModel):
|
||||
author_position_count: AuthorPositionCount
|
||||
publication_ids: PublicationIdsByAuthorPosition
|
||||
publication_urls: dict[str, str] = {}
|
||||
publication_titles: dict[str, str] = {}
|
||||
|
||||
|
||||
class FundersByAuthorResponse(BaseModel):
|
||||
|
||||
@@ -20,14 +20,33 @@
|
||||
<!-- Filter Buttons -->
|
||||
<div class="filter-bar">
|
||||
<span>Filter nach Position:</span>
|
||||
<button [class.active]="activeFilter === 'all'" (click)="setFilter('all')">Alle</button>
|
||||
<button [class.active]="activeFilter === 'first'" (click)="setFilter('first')">Erstautor</button>
|
||||
<button [class.active]="activeFilter === 'middle'" (click)="setFilter('middle')">Mitautor</button>
|
||||
<button [class.active]="activeFilter === 'last'" (click)="setFilter('last')">Letztautor</button>
|
||||
<button
|
||||
[class.active]="activeFilter === 'all'"
|
||||
(click)="setFilter('all')"
|
||||
>
|
||||
Alle
|
||||
</button>
|
||||
<button
|
||||
[class.active]="activeFilter === 'first'"
|
||||
(click)="setFilter('first')"
|
||||
>
|
||||
Erstautor
|
||||
</button>
|
||||
<button
|
||||
[class.active]="activeFilter === 'middle'"
|
||||
(click)="setFilter('middle')"
|
||||
>
|
||||
Mitautor
|
||||
</button>
|
||||
<button
|
||||
[class.active]="activeFilter === 'last'"
|
||||
(click)="setFilter('last')"
|
||||
>
|
||||
Letztautor
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="funding-content">
|
||||
|
||||
<!-- Linke Seite: Tabelle -->
|
||||
<div class="funding-list">
|
||||
<table>
|
||||
@@ -51,11 +70,20 @@
|
||||
</table>
|
||||
@if (hasFunderListPagination()) {
|
||||
<div class="publication-pagination">
|
||||
<button [disabled]="selectedFunderListPage === 1" (click)="setFunderListPage(selectedFunderListPage - 1)">
|
||||
<button
|
||||
[disabled]="selectedFunderListPage === 1"
|
||||
(click)="setFunderListPage(selectedFunderListPage - 1)"
|
||||
>
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ selectedFunderListPage }} von {{ getFunderListPageCount() }}</span>
|
||||
<button [disabled]="selectedFunderListPage === getFunderListPageCount()" (click)="setFunderListPage(selectedFunderListPage + 1)">
|
||||
<span
|
||||
>Seite {{ selectedFunderListPage }} von
|
||||
{{ getFunderListPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
[disabled]="selectedFunderListPage === getFunderListPageCount()"
|
||||
(click)="setFunderListPage(selectedFunderListPage + 1)"
|
||||
>
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
@@ -68,41 +96,75 @@
|
||||
<h3>{{ selectedFunder.funder_name }}</h3>
|
||||
|
||||
<div class="position-stats">
|
||||
@if (shouldShowPosition('first')) {
|
||||
<div class="stat">
|
||||
<span class="stat-label">Erstautor</span>
|
||||
<span class="stat-value">{{ selectedFunder.author_position_count.first }}</span>
|
||||
</div>
|
||||
@if (shouldShowPosition("first")) {
|
||||
<div class="stat stat-first">
|
||||
<span class="stat-label">Erstautor</span>
|
||||
<span class="stat-value">{{
|
||||
selectedFunder.author_position_count.first
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
@if (shouldShowPosition('middle')) {
|
||||
<div class="stat">
|
||||
<span class="stat-label">Mitautor</span>
|
||||
<span class="stat-value">{{ selectedFunder.author_position_count.middle }}</span>
|
||||
</div>
|
||||
@if (shouldShowPosition("middle")) {
|
||||
<div class="stat stat-middle">
|
||||
<span class="stat-label">Mitautor</span>
|
||||
<span class="stat-value">{{
|
||||
selectedFunder.author_position_count.middle
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
@if (shouldShowPosition('last')) {
|
||||
<div class="stat">
|
||||
<span class="stat-label">Letztautor</span>
|
||||
<span class="stat-value">{{ selectedFunder.author_position_count.last }}</span>
|
||||
</div>
|
||||
@if (shouldShowPosition("last")) {
|
||||
<div class="stat stat-last">
|
||||
<span class="stat-label">Letztautor</span>
|
||||
<span class="stat-value">{{
|
||||
selectedFunder.author_position_count.last
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<h4>Publikationen</h4>
|
||||
<ul class="publication-list">
|
||||
@for (id of getSelectedPublicationIdsPage(); track id) {
|
||||
<li>
|
||||
<a [href]="getPublicationUrl(id)" target="_blank" rel="noopener" (click)="openPublication($event, id)">{{ id }}</a>
|
||||
<li class="publication-item" (click)="togglePublication(id)">
|
||||
<span class="publication-title">{{
|
||||
getPublicationTitle(id)
|
||||
}}</span>
|
||||
@if (expandedPublicationId === id) {
|
||||
<div class="publication-more-info">
|
||||
<span class="mehr-infos-label">Mehr Infos</span>
|
||||
<a
|
||||
[href]="getPublicationUrl(id)"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
(click)="openPublication($event, id)"
|
||||
class="publication-link-icon"
|
||||
title="Publikation öffnen"
|
||||
>
|
||||
<span class="material-icons">open_in_new</span>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@if (hasPublicationPagination()) {
|
||||
<div class="publication-pagination">
|
||||
<button [disabled]="selectedPublicationPage === 1" (click)="setPublicationPage(selectedPublicationPage - 1)">
|
||||
<button
|
||||
[disabled]="selectedPublicationPage === 1"
|
||||
(click)="setPublicationPage(selectedPublicationPage - 1)"
|
||||
>
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ selectedPublicationPage }} von {{ getSelectedPublicationPageCount() }}</span>
|
||||
<button [disabled]="selectedPublicationPage === getSelectedPublicationPageCount()" (click)="setPublicationPage(selectedPublicationPage + 1)">
|
||||
<span
|
||||
>Seite {{ selectedPublicationPage }} von
|
||||
{{ getSelectedPublicationPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
[disabled]="
|
||||
selectedPublicationPage === getSelectedPublicationPageCount()
|
||||
"
|
||||
(click)="setPublicationPage(selectedPublicationPage + 1)"
|
||||
>
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
@@ -113,7 +175,6 @@
|
||||
<p>Klicke auf einen Förderer für Details.</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -33,17 +33,30 @@
|
||||
&:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background:
|
||||
radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.78), transparent 34%),
|
||||
linear-gradient(145deg, #c8d9ff, #f7faff 48%, #88a9ee);
|
||||
color: var(--sg-primary);
|
||||
border-color: var(--sg-border);
|
||||
font-weight: 600;
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
}
|
||||
button:nth-child(2) {
|
||||
background: #f0f6ff;
|
||||
color: #0b63ce;
|
||||
border-color: #bdd4ff;
|
||||
}
|
||||
|
||||
button:nth-child(3) {
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
border-color: #bdebcf;
|
||||
}
|
||||
|
||||
button:nth-child(4) {
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
border-color: #d8cafe;
|
||||
}
|
||||
|
||||
button:nth-child(5) {
|
||||
background: #fff7e8;
|
||||
color: #c67500;
|
||||
border-color: #ffd796;
|
||||
}
|
||||
}
|
||||
|
||||
.funding-content {
|
||||
@@ -93,7 +106,7 @@
|
||||
}
|
||||
|
||||
.funding-detail {
|
||||
width: 340px;
|
||||
width: 440px;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
@@ -124,9 +137,13 @@
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
.stat {
|
||||
flex: 1;
|
||||
flex: 0.0 auto;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
background: white;
|
||||
border: 1px solid #e0e0e0;
|
||||
@@ -147,6 +164,20 @@
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.stat-first {
|
||||
background: #effaf3;
|
||||
border-color: #bdebcf;
|
||||
}
|
||||
|
||||
.stat-middle {
|
||||
background: #f6f0ff;
|
||||
border-color: #d8cafe;
|
||||
}
|
||||
|
||||
.stat-last {
|
||||
background: #fff7e8;
|
||||
border-color: #ffd796;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-list {
|
||||
@@ -158,7 +189,7 @@
|
||||
|
||||
li {
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
border-bottom: 1px solid #5b5555;
|
||||
font-size: 13px;
|
||||
|
||||
a {
|
||||
@@ -219,3 +250,49 @@
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.publication-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 2px solid #5b5555;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-title {
|
||||
font-size: 0.875rem;
|
||||
color: #333;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
display: block;
|
||||
}
|
||||
.publication-more-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.mehr-infos-label {
|
||||
font-size: 0.8rem;
|
||||
color: #1976d2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.publication-link-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #1976d2;
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
|
||||
.material-icons {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #0d47a1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ export class PersonFundingComponent implements OnInit {
|
||||
activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all';
|
||||
loading = true;
|
||||
error = false;
|
||||
expandedPublicationId: string | null = null;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.parent?.paramMap.subscribe(params => {
|
||||
@@ -257,4 +258,13 @@ export class PersonFundingComponent implements OnInit {
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
getPublicationTitle(publicationId: string): string {
|
||||
const title = this.selectedFunder?.publication_titles?.[publicationId];
|
||||
if (title) return title;
|
||||
const parts = publicationId.split('/');
|
||||
return parts[parts.length - 1] ?? publicationId;
|
||||
}
|
||||
togglePublication(id: string): void {
|
||||
this.expandedPublicationId = this.expandedPublicationId === id ? null : id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user