Refined orte

This commit is contained in:
Simon Martens
2025-09-27 17:44:34 +02:00
parent d48bba8e92
commit e8ff6d3d37
20 changed files with 882 additions and 906 deletions

View File

@@ -0,0 +1,8 @@
{{- /* Back navigation for individual place pages */ -}}
<!-- Back Navigation -->
<div class="mb-6">
<a href="/ort/" class="inline-flex items-center hover:text-black text-gray-600 transition-colors text-xl no-underline font-bold">
<i class="ri-arrow-left-line mr-1 text-xl font-bold"></i>
Orte
</a>
</div>

View File

@@ -0,0 +1,42 @@
{{- /* Individual place card for overview grid */ -}}
{{ $geonames := GetGeonames .Geo }}
{{ $mainPlaceName := "" }}
{{ if .Names }}
{{ $mainPlaceName = index .Names 0 }}
{{ else }}
{{ $mainPlaceName = .ID }}
{{ end }}
{{ $modernName := GetModernPlaceName .Geo $mainPlaceName }}
<div class="border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors h-20" data-place-name="{{ $mainPlaceName }}" data-modern-name="{{ $modernName }}">
<a href="/ort/{{ .ID }}" class="block p-4 h-full flex flex-col justify-between">
<div class="flex items-start justify-between gap-2">
<div class="flex-1">
<h3 class="font-medium text-slate-800 mb-1">
{{ if .Names }}
{{ index .Names 0 }}
{{ else }}
{{ .ID }}
{{ end }}
</h3>
<!-- Show geographic info if available (only if not Germany) -->
{{ if ne $geonames nil }}
{{ $mainPlaceName := "" }}
{{ if .Names }}
{{ $mainPlaceName = index .Names 0 }}
{{ end }}
{{ $fullInfo := GetFullPlaceInfo .Geo $mainPlaceName }}
{{ if ne $fullInfo "" }}
<p class="text-sm text-slate-600 mb-1">
<i class="ri-map-pin-line mr-1"></i>{{ $fullInfo }}
</p>
{{ end }}
{{ else if .Geo }}
<p class="text-sm text-slate-600">
<i class="ri-map-pin-line mr-1"></i>Geonames verfügbar
</p>
{{ end }}
</div>
</div>
</a>
</div>

View File

@@ -0,0 +1,71 @@
{{- /* Place header with name, geographic info, and external links */ -}}
<!-- Place Header -->
<div class="mb-8">
{{ $geonames := GetGeonames .Place.Geo }}
<!-- Name and external links - similar to akteure header -->
<div class="flex items-start justify-between gap-4">
<div class="flex-1">
<h1 class="text-3xl font-bold text-slate-800 mb-2">
{{ if .Place.Names }}
{{ index .Place.Names 0 }}
{{ else }}
{{ .Place.ID }}
{{ end }}
</h1>
<!-- Geographic Information from Geonames -->
{{ if ne $geonames nil }}
<div class="text-lg text-slate-700 mb-2">
<!-- Modern Country Info (only if not Germany) -->
{{ $mainPlaceName := "" }}
{{ if .Place.Names }}
{{ $mainPlaceName = index .Place.Names 0 }}
{{ end }}
{{ $fullInfo := GetFullPlaceInfo .Place.Geo $mainPlaceName }}
{{ if ne $fullInfo "" }}
<div class="mb-1">{{ $fullInfo }}</div>
{{ end }}
<!-- Coordinates -->
<div class="text-slate-600 text-base space-y-1">
{{ if and (ne $geonames.Lat "") (ne $geonames.Lng "") }}
<div>
<i class="ri-map-pin-line mr-1"></i><a href="https://www.openstreetmap.org/?mlat={{ $geonames.Lat }}&mlon={{ $geonames.Lng }}&zoom=12" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-700 underline">{{ $geonames.Lat }}, {{ $geonames.Lng }}</a>
</div>
{{ end }}
</div>
</div>
{{ else }}
<!-- Fallback when no Geonames data -->
{{ if .Place.Geo }}
<p class="text-slate-600 mb-2">
<i class="ri-map-pin-line mr-1"></i>
<a href="{{ .Place.Geo }}" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-700 underline">
Geonames
</a>
</p>
{{ end }}
{{ end }}
</div>
<!-- External link symbols on the right - similar to akteure -->
<div class="flex gap-3 flex-shrink-0 items-center">
{{ if ne $geonames nil }}
<!-- Wikipedia link if available -->
{{ if ne $geonames.WikipediaURL "" }}
<a href="https://{{ $geonames.WikipediaURL }}" target="_blank" class="hover:opacity-80 transition-opacity" title="Wikipedia">
<img src="/assets/wikipedia.png" alt="Wikipedia" class="w-6 h-6">
</a>
{{ end }}
{{ end }}
<!-- Geonames link -->
{{ if .Place.Geo }}
<a href="{{ .Place.Geo }}" target="_blank" class="hover:opacity-80 transition-opacity no-underline" title="Geonames">
<i class="ri-global-line text-xl text-blue-600"></i>
</a>
{{ end }}
</div>
</div>
</div>

View File

@@ -0,0 +1,98 @@
{{- /* Associated pieces section for place detail view */ -}}
<!-- Associated Pieces -->
<div>
<h2 class="text-xl font-semibold text-slate-800 mb-4">
<i class="ri-newspaper-line mr-2"></i><u class="decoration underline-offset-3">Verlinkte Beiträge</u> ({{ len .Pieces }})
</h2>
{{ if .Pieces }}
{{- /* Group pieces by year */ -}}
{{- $piecesByYear := dict -}}
{{- range $_, $p := .Pieces -}}
{{- range $issueRef := $p.IssueRefs -}}
{{- $year := printf "%d" $issueRef.When.Year -}}
{{- $existing := index $piecesByYear $year -}}
{{- if $existing -}}
{{- $piecesByYear = merge $piecesByYear (dict $year (append $existing $p)) -}}
{{- else -}}
{{- $piecesByYear = merge $piecesByYear (dict $year (slice $p)) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Get sorted years */ -}}
{{- $sortedYears := slice -}}
{{- range $year, $pieces := $piecesByYear -}}
{{- $sortedYears = append $sortedYears $year -}}
{{- end -}}
{{- $sortedYears = sortStrings $sortedYears -}}
<div class="space-y-6 max-w-[85ch]">
{{- range $year := $sortedYears -}}
{{- $yearPieces := index $piecesByYear $year -}}
<!-- Year Header -->
<div>
<h3 class="text-lg font-bold font-serif text-slate-800 mb-3">{{ $year }}</h3>
<div class="space-y-1">
{{- /* Group pieces by title within each year */ -}}
{{- $groupedPieces := dict -}}
{{- range $_, $p := $yearPieces -}}
{{- $groupKey := "" -}}
{{- if $p.Title -}}
{{- $groupKey = index $p.Title 0 -}}
{{- else if $p.Incipit -}}
{{- $groupKey = index $p.Incipit 0 -}}
{{- else -}}
{{- $groupKey = printf "untitled-%s" $p.ID -}}
{{- end -}}
{{- $existing := index $groupedPieces $groupKey -}}
{{- if $existing -}}
{{- $groupedPieces = merge $groupedPieces (dict $groupKey (append $existing $p)) -}}
{{- else -}}
{{- $groupedPieces = merge $groupedPieces (dict $groupKey (slice $p)) -}}
{{- end -}}
{{- end -}}
{{- range $groupKey, $groupedItems := $groupedPieces -}}
<div>
<div class="pb-1 text-lg indent-4">
{{- /* Use first piece for display text with colon format for places */ -}}
{{ template "_piece_summary_for_place" (dict "Piece" (index $groupedItems 0) "CurrentActorID" "") }}
{{- /* Show all citations from all pieces in this group inline with commas */ -}}
{{ " " }}{{- range $groupIndex, $groupItem := $groupedItems -}}
{{- range $issueIndex, $issue := $groupItem.IssueRefs -}}
{{- /* Only show citations for the current year */ -}}
{{- if eq (printf "%d" $issue.When.Year) $year -}}
{{- if or (gt $groupIndex 0) (gt $issueIndex 0) }}, {{ end -}}
<span class="text-blue-600 hover:text-blue-700 underline decoration-dotted hover:decoration-solid [&>a]:text-blue-600 [&>a:hover]:text-blue-700">{{- template "_citation" $issue -}}</span>
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Add "Ganzer Beitrag" link if piece spans multiple issues */ -}}
{{- $firstGroupItem := index $groupedItems 0 -}}
{{- if gt (len $firstGroupItem.IssueRefs) 1 -}}
{{ " " }}<div class="inline-flex items-center gap-1 px-2 py-1 bg-blue-50
hover:bg-blue-100 text-blue-700 hover:text-blue-800 border border-blue-200
hover:border-blue-300 rounded text-xs font-medium transition-colors duration-200">
<i class="ri-file-copy-2-line text-xs"></i>
<a href="{{ GetPieceURL $firstGroupItem.ID }}" class="">
Ganzer Beitrag
</a>
</div>
{{- end }}
</div>
</div>
{{- end -}}
</div>
</div>
{{- end -}}
</div>
{{ else }}
<p class="text-slate-500 italic">Keine verlinkten Beiträge für diesen Ort gefunden.</p>
{{ end }}
</div>