finish person view

This commit is contained in:
Simon Martens
2025-09-21 19:25:50 +02:00
parent 94883b5edc
commit 810de82442
11 changed files with 550 additions and 382 deletions

View File

@@ -75,7 +75,7 @@
Ganzer Beitrag
</a>
</div>
{{- end -}}
{{- end }}
</div>
</div>
{{- end -}}

View File

@@ -5,10 +5,11 @@
<!-- Name and external links -->
<div class="flex items-start justify-between gap-4">
<div class="flex-1">
<!-- Large serif name - bold -->
<div class="text-xl font-serif font-bold mb-1">
<a href="/akteure/{{ $a.ID }}" class="hover:text-slate-900 transition-colors no-underline">
{{ index $a.Names 0 }}
<!-- Large serif name - bold with inline permalink icon -->
<div class="text-xl font-serif font-bold mb-1 flex items-center gap-2">
<span>{{ index $a.Names 0 }}</span>
<a href="/akteure/{{ $a.ID }}" class="text-gray-500 hover:text-blue-600 transition-colors text-lg no-underline" title="Permalink zu {{ index $a.Names 0 }}">
<i class="ri-link text-base"></i>
</a>
</div>
@@ -41,19 +42,19 @@
</div>
<!-- External link symbols on the right -->
<div class="flex gap-2 flex-shrink-0">
<div class="flex gap-3 flex-shrink-0 items-center">
{{- if ne $gnd nil -}}
{{- /* Wikipedia link if available */ -}}
{{- if ne (len $gnd.Wikipedia) 0 -}}
<a href="{{ (index $gnd.Wikipedia 0).ID }}" target="_blank" class="text-gray-500 hover:text-blue-600 transition-colors text-lg" title="Wikipedia">
<i class="ri-wikipedia-line"></i>
<a href="{{ (index $gnd.Wikipedia 0).ID }}" target="_blank" class="hover:opacity-80 transition-opacity" title="Wikipedia">
<img src="/assets/wikipedia.png" alt="Wikipedia" class="w-6 h-6">
</a>
{{- end -}}
{{- /* GND link if available */ -}}
{{- if ne $a.GND "" -}}
<a href="{{ $a.GND }}" target="_blank" class="text-gray-500 hover:text-blue-600 transition-colors text-lg" title="Gemeinsame Normdatei">
<i class="ri-links-line"></i>
<a href="{{ $a.GND }}" target="_blank" class="hover:opacity-80 transition-opacity" title="Gemeinsame Normdatei">
<img src="/assets/GND.png" alt="GND" class="w-6 h-6">
</a>
{{- else -}}
{{- /* VIAF link if no GND available */ -}}

View File

@@ -36,8 +36,8 @@
{{ $workPieces := LookupPieces $w.Item }}
{{ if len $workPieces }}
<div class="mt-1 text-lg">
{{- /* Group pieces by category and display inline */ -}}
{{- $groupedByCategory := dict -}}
{{- /* Group pieces by piece ID first to combine all categories per piece, then by additional authors */ -}}
{{- $pieceData := dict -}}
{{- range $_, $p := $workPieces -}}
{{- $categoryFlags := GetCategoryFlags $p.Item -}}
{{- $categories := slice -}}
@@ -138,16 +138,22 @@
{{- end -}}
{{- $sortedAdditionalAuthorIDs := sortStrings $pieceAdditionalAuthorIDs -}}
{{- /* Create grouping key with category + additional authors */ -}}
{{- $sortedCategories := sortStrings $categories -}}
{{- /* Store piece data by ID to combine categories and avoid duplicates */ -}}
{{- $pieceData = merge $pieceData (dict $p.Item.ID (dict "piece" $p "categories" $categories "additionalAuthorIDs" $sortedAdditionalAuthorIDs)) -}}
{{- end -}}
{{- /* Now group by combined categories and additional authors */ -}}
{{- $groupedByCategory := dict -}}
{{- range $pieceID, $data := $pieceData -}}
{{- $sortedCategories := sortStrings $data.categories -}}
{{- $categoryName := joinWithUnd $sortedCategories -}}
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $sortedAdditionalAuthorIDs) -}}
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $data.additionalAuthorIDs) -}}
{{- $existing := index $groupedByCategory $groupKey -}}
{{- if $existing -}}
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (append $existing $p)) -}}
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (append $existing $data.piece)) -}}
{{- else -}}
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (slice $p)) -}}
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (slice $data.piece)) -}}
{{- end -}}
{{- end -}}
@@ -213,8 +219,8 @@
{{- /* Process standalone work pieces that aren't linked to specific works */ -}}
{{- if ne (len $workPieces) 0 -}}
{{- /* Group standalone work pieces by category and additional authors */ -}}
{{- $standaloneGrouped := dict -}}
{{- /* Group standalone work pieces by piece ID first to combine categories, then by additional authors */ -}}
{{- $standalonePieceData := dict -}}
{{- range $_, $p := $workPieces -}}
{{- /* Skip pieces that are already covered by works above */ -}}
{{- $isPieceInWorks := false -}}
@@ -266,21 +272,27 @@
{{- end -}}
{{- $sortedAdditionalAuthorIDs := sortStrings $pieceAdditionalAuthorIDs -}}
{{- /* Create grouping key with category + additional authors */ -}}
{{- $sortedCategories := sortStrings $categories -}}
{{- $categoryName := joinWithUnd $sortedCategories -}}
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $sortedAdditionalAuthorIDs) -}}
{{- $existing := index $standaloneGrouped $groupKey -}}
{{- if $existing -}}
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (append $existing $p)) -}}
{{- else -}}
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (slice $p)) -}}
{{- end -}}
{{- /* Store piece data by ID to combine categories and avoid duplicates */ -}}
{{- $standalonePieceData = merge $standalonePieceData (dict $p.Item.ID (dict "piece" $p "categories" $categories "additionalAuthorIDs" $sortedAdditionalAuthorIDs)) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Now group by combined categories and additional authors */ -}}
{{- $standaloneGrouped := dict -}}
{{- range $pieceID, $data := $standalonePieceData -}}
{{- $sortedCategories := sortStrings $data.categories -}}
{{- $categoryName := joinWithUnd $sortedCategories -}}
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $data.additionalAuthorIDs) -}}
{{- $existing := index $standaloneGrouped $groupKey -}}
{{- if $existing -}}
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (append $existing $data.piece)) -}}
{{- else -}}
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (slice $data.piece)) -}}
{{- end -}}
{{- end -}}
{{- /* Display standalone work pieces */ -}}
{{- range $groupKey, $categoryPieces := $standaloneGrouped -}}
<div class="mb-1.5 break-inside-avoid max-w-[95ch]">