Better scrollspy persons

This commit is contained in:
Simon Martens
2025-09-21 13:58:56 +02:00
parent 3f2811acbc
commit 758ded07fa
8 changed files with 82 additions and 87 deletions

View File

@@ -62,29 +62,27 @@
<!-- Two Column Layout: Scrollspy + Content -->
<div class="flex gap-8">
<!-- Scrollspy Navigation - Hidden on smaller screens, shown on 2xl+ -->
<div class="hidden 2xl:block w-80 flex-shrink-0">
<div class="sticky top-8 h-screen">
<div class="bg-white border border-gray-200 rounded-lg p-4 h-full flex flex-col">
<h3 class="text-lg font-bold text-gray-900 mb-4">Auf dieser Seite</h3>
<nav class="flex-1 overflow-y-auto" id="scrollspy-nav">
<div class="hidden 2xl:block w-96 flex-shrink-0">
<div class="sticky top-0 max-h-screen bg-white rounded py-4 h-full flex flex-col border-x-6 border-white">
<nav class="flex-1 overflow-y-auto overscroll-contain" id="scrollspy-nav">
{{ range $_, $id := .model.Sorted }}
{{ $a := index $.model.Agents $id }}
<a href="#author-{{ $id }}"
class="block px-3 py-1 text-base text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded scrollspy-link transition-colors border-l-4 border-transparent"
class="block px-2 py-0.5 text-lg text-gray-900 hover:bg-red-50 scrollspy-link
transition-colors no-underline box-content"
data-target="author-{{ $id }}">
{{ index $a.Names 0 }}
</a>
{{ end }}
</nav>
</div>
</div>
</div>
<!-- People List - Main Content -->
<div class="flex-1 space-y-6">
<div class="flex-1 space-y-6 bg-white">
{{ range $_, $id := .model.Sorted }}
{{ $a := index $.model.Agents $id }}
<div id="author-{{ $id }}" class="bg-stone-100 rounded-lg p-6 border border-stone-200 scroll-mt-8 author-section">
<div id="author-{{ $id }}" class="p-6 scroll-mt-8 author-section">
{{ template "_akteur" $a }}
</div>
{{ end }}

View File

@@ -1,10 +1,10 @@
{{ $a := . }}
{{ $pieces := LookupPieces $a }}
{{ if ne (len $pieces) 0 }}
<div class="mt-8">
<div class="px-4 py-3 rounded-lg mb-4">
<h2 class="text-lg font-bold text-gray-900">
<i class="ri-newspaper-line mr-2"></i>Beiträge
<div class="mt-4">
<div class="py-1 rounded-lg mb-1">
<h2 class="text-lg font-bold">
<i class="ri-newspaper-line mr-2"></i><u class="decoration underline-offset-3">Beiträge</u>
</h2>
</div>
<div class="space-y-2">
@@ -39,10 +39,12 @@
<div class="columns-2 gap-6">
{{- /* Display grouped pieces */ -}}
{{- range $groupKey, $groupedItems := $groupedPieces -}}
<div class="border-l-2 border-gray-200 pl-4 break-inside-avoid">
<div class="text-lg">
<div class="break-inside-avoid">
<div class="text-lg pb-1">
{{- /* Use first piece for display text */ -}}
<span class="inline-block indent-6">
{{ template "_piece_summary" (dict "Piece" (index $groupedItems 0).Item "CurrentActorID" $a.ID) }}
</span>
{{- /* Show all citations from all pieces in this group */ -}}
{{- range $_, $groupItem := $groupedItems -}}
@@ -56,7 +58,7 @@
{{- $url = printf "%s/%d" $url $issue.Von -}}
{{- end -}}
{{- end -}}
<a href="{{ $url }}" class="inline-block text-sm bg-green-50 text-green-700 hover:bg-green-100 hover:text-green-800 px-3 py-2 rounded ml-2 no-underline">
<a href="{{ $url }}" class="ml-1.5 inline-block text-blue-700 hover:text-blue-800">
{{- if $issueData -}}
{{ $issueData.Datum.When.Day }}.{{ $issueData.Datum.When.Month }}.{{ $issueData.Datum.When.Year }}/{{ $issue.Nr }}, S. {{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) }}-{{ $issue.Bis }}{{ end }}
{{- else -}}

View File

@@ -6,16 +6,16 @@
<div class="flex items-start justify-between gap-4">
<div class="flex-1">
<!-- Large serif name - bold -->
<div class="text-2xl font-serif font-bold text-gray-900 leading-tight">
<a href="/akteure/{{ $a.ID }}" class="hover:text-blue-600 transition-colors">
<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 }}
</a>
</div>
<!-- Years only below name -->
<!-- Years ONLY below name -->
{{ if ne $gnd nil }}
{{- if or (ne (len $gnd.DateOfBirth) 0) (ne (len $gnd.DateOfDeath) 0) -}}
<div class="text-gray-600 text-xl mt-2">
<div class="text-gray-800 text-lg">
{{- if ne (len $gnd.DateOfBirth) 0 -}}
{{ HRDateYear (index $gnd.DateOfBirth 0) }}
{{- end -}}
@@ -29,7 +29,7 @@
<!-- First three professions -->
{{ if ne $gnd nil }}
{{- if ne (len $gnd.ProfessionOrOccupation) 0 -}}
<div class="text-gray-600 text-xl mt-2">
<div class="text-gray-800 text-lg">
{{ range $i, $prof := $gnd.ProfessionOrOccupation }}
{{ if lt $i 3 }}
{{ if gt $i 0 }} · {{ end }}{{ $prof.Label }}
@@ -70,4 +70,4 @@
{{- end -}}
</div>
</div>
{{ end }}
{{ end }}

View File

@@ -1,26 +1,20 @@
{{ $a := . }}
{{ $works := LookupWorks $a }}
{{- if ne (len $works) 0 -}}
<div class="mt-8">
<div class="px-4 py-3 rounded-lg mb-4">
<h2 class="text-lg font-bold text-gray-900">
<i class="ri-book-line mr-2"></i>Werke
<div class="mt-4">
<div class="py-1 rounded-lg mb-1">
<h2 class="text-lg font-bold">
<i class="ri-book-line mr-2"></i><u class="decoration underline-offset-3">Werke</u>
</h2>
</div>
<div class="columns-2 gap-6">
<div class="">
{{ range $_, $w := $works }}
<div class="mb-2 break-inside-avoid pl-4">
<div class="mb-1.5 break-inside-avoid max-w-[95ch]">
{{- if ne (len $w.Item.Citation.InnerXML ) 0 -}}
<div class="text-lg">
<span class="italic">
<script type="application/xml" xslt-template="transform-citation" xslt-onload>
<xml>
{{- Safe $w.Item.Citation.InnerXML -}}
</xml>
</script>
</span>
<div class="text-lg indent-6">
{{- Safe $w.Item.Citation.HTML -}}
{{- range $_, $url := $w.Item.URLs -}}
<span class="ml-1">
<span class="ml-1 whitespace-nowrap">
<a href="{{ $url.Address }}" target="_blank" class="text-blue-600 hover:text-blue-800 text-sm">
{{ $url.Chardata }} <i class="ri-external-link-line text-xs"></i>
</a>
@@ -141,7 +135,8 @@
{{- /* Display each category group */ -}}
{{- range $categoryName, $categoryPieces := $groupedByCategory -}}
<span class="inline-block text-sm bg-green-50 text-green-700 px-3 py-2 rounded ml-2">
<div>
<span class="inline-block">
{{ $categoryName }}
{{- /* Check for additional authors (non-current actor) */ -}}
{{- $additionalAuthorIDs := slice -}}
@@ -154,7 +149,7 @@
{{- end -}}
{{- $uniqueAuthorIDs := unique $additionalAuthorIDs -}}
{{- if $uniqueAuthorIDs -}}
{{ " " }}von {{ range $i, $authorID := $uniqueAuthorIDs }}{{- if gt $i 0 }} und {{ end }}{{- $agent := GetAgent $authorID -}}{{- if and $agent (gt (len $agent.Names) 0) -}}<a href="/akteure/{{ $authorID }}" class="text-green-700 hover:text-green-900 underline text-sm font-bold">{{ index $agent.Names 0 }}</a>{{- end -}}{{ end }}
{{ " " }}von {{ range $i, $authorID := $uniqueAuthorIDs }}{{- if gt $i 0 }} und {{ end }}{{- $agent := GetAgent $authorID -}}{{- if and $agent (gt (len $agent.Names) 0) -}}<a href="/akteure/{{ $authorID }}" class="">{{ index $agent.Names 0 }}</a>{{- end -}}{{ end }}
{{- end -}}{{ ":" }}
</span>
{{- /* Show all citations for this category */ -}}
@@ -169,7 +164,7 @@
{{- $url = printf "%s/%d" $url $issue.Von -}}
{{- end -}}
{{- end -}}
<a href="{{ $url }}" class="inline-block text-sm bg-blue-50 text-blue-700 hover:bg-blue-100 hover:text-blue-800 px-3 py-2 rounded ml-2 no-underline">
<a href="{{ $url }}" class="inline-block text-blue-700 hover:text-blue-800 rounded ml-2 ">
{{- if $issueData -}}
{{ $issueData.Datum.When.Day }}.{{ $issueData.Datum.When.Month }}.{{ $issueData.Datum.When.Year }}/{{ $issue.Nr }}, S. {{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) }}-{{ $issue.Bis }}{{ end }}
{{- else -}}
@@ -178,6 +173,7 @@
</a>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
</div>
{{ end }}

View File

@@ -1,7 +1,6 @@
{{- $piece := .Piece -}}
{{- $currentActorID := .CurrentActorID -}}
<div class="leading-snug">
{{- $categoryFlags := GetCategoryFlags $piece -}}
{{- $place := "" -}}
@@ -199,4 +198,3 @@
{{- end -}}
{{- end -}}
</div>