Files
kgpz_web/views/routes/components/_akteur.gohtml
Simon Martens 0f6ffbf63f Stuff
2025-09-20 22:01:41 +02:00

145 lines
4.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{ $a := . }}
{{ if and $a (ne (len $a.Names) 0) }}
{{ $gnd := GetGND $a.GND }}
{{ $works := LookupWorks $a }}
{{ $pieces := LookupPieces $a }}
<div>
<!-- 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 text-gray-900 leading-tight">
<a href="/akteure/{{ $a.ID }}" class="hover:text-blue-600 transition-colors">
{{ index $a.Names 0 }}
</a>
</div>
<!-- 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-sm mt-1">
{{- if ne (len $gnd.DateOfBirth) 0 -}}
{{ HRDateYear (index $gnd.DateOfBirth 0) }}
{{- end -}}
{{- if ne (len $gnd.DateOfDeath) 0 -}}
{{ HRDateYear (index $gnd.DateOfDeath 0) }}
{{- end -}}
</div>
{{- end -}}
{{ end }}
<!-- First three professions -->
{{ if ne $gnd nil }}
{{- if ne (len $gnd.ProfessionOrOccupation) 0 -}}
<div class="text-gray-600 text-sm mt-1">
{{ range $i, $prof := $gnd.ProfessionOrOccupation }}
{{ if lt $i 3 }}
{{ if gt $i 0 }} · {{ end }}{{ $prof.Label }}
{{ end }}
{{ end }}
</div>
{{- end -}}
{{ end }}
</div>
<!-- External link symbols on the right -->
<div class="flex gap-2 flex-shrink-0">
{{- 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>
{{- 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>
{{- else -}}
{{- /* VIAF link if no GND available */ -}}
{{- if ne (len $gnd.SameAs) 0 -}}
{{ range $_, $ref := $gnd.SameAs }}
{{- if ne $ref.ID "" -}}
<a href="{{ $ref.ID }}" target="_blank" class="text-gray-500 hover:text-blue-600 transition-colors text-lg" title="External Link">
<i class="ri-global-line"></i>
</a>
{{- end -}}
{{ end }}
{{- end -}}
{{- end -}}
{{- end -}}
</div>
</div>
{{- if ne (len $works) 0 -}}
<div class="mt-3">
<div class="text-sm font-medium text-gray-700 mb-2">
<i class="ri-book-line mr-1"></i>Werke
</div>
{{ range $_, $w := $works }}
<div class="mb-2">
{{- if ne (len $w.Item.Citation.InnerXML ) 0 -}}
<div class="text-sm">
<span class="italic">
<script type="application/xml" xslt-template="transform-citation" xslt-onload>
<xml>
{{- Safe $w.Item.Citation.InnerXML -}}
</xml>
</script>
</span>
{{- range $_, $url := $w.Item.URLs -}}
<span class="ml-1">
<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>
</span>
{{- end -}}
</div>
{{- end -}}
{{ $workPieces := LookupPieces $w.Item }}
{{ if len $workPieces }}
<div class="flex flex-wrap gap-1 mt-1">
{{ range $_, $p := $workPieces }}
{{ range $_, $issue := $p.Item.IssueRefs }}
<span class="inline-block bg-green-50 hover:bg-green-100 text-green-700 hover:text-green-800 px-2 py-1 rounded text-xs transition-colors">
{{ template "_citation" $issue }}
</span>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
{{ $pieces := LookupPieces $a }}
{{ if ne (len $pieces) 0 }}
<div class="mt-3">
<div class="text-sm font-medium text-gray-700 mb-2">
<i class="ri-newspaper-line mr-1"></i>Beiträge
</div>
<div class="space-y-2">
{{ range $_, $p := SortPiecesByDate $pieces }}
<div class="border-l-2 border-gray-200 pl-3">
<div class="text-sm">
{{ template "_piece_summary" $p.Item }}
</div>
<div class="mt-1 flex flex-wrap gap-1">
{{ range $_, $issue := $p.Item.IssueRefs }}
<span class="inline-block bg-green-50 hover:bg-green-100 text-green-700 hover:text-green-800 px-2 py-1 rounded text-xs transition-colors">
{{ template "_citation" $issue }}
</span>
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
{{ end }}