mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 00:55:32 +00:00
Some improvements with the akteure page
This commit is contained in:
188
views/routes/components/_akteur_werke.gohtml
Normal file
188
views/routes/components/_akteur_werke.gohtml
Normal file
@@ -0,0 +1,188 @@
|
||||
{{ $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
|
||||
</h2>
|
||||
</div>
|
||||
<div class="columns-2 gap-6">
|
||||
{{ range $_, $w := $works }}
|
||||
<div class="mb-2 break-inside-avoid pl-4">
|
||||
{{- 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>
|
||||
{{- 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="mt-1 text-lg">
|
||||
{{- /* Group pieces by category and display inline */ -}}
|
||||
{{- $groupedByCategory := dict -}}
|
||||
{{- range $_, $p := $workPieces -}}
|
||||
{{- $categoryFlags := GetCategoryFlags $p.Item -}}
|
||||
{{- $categories := slice -}}
|
||||
{{- if $categoryFlags.Rezension -}}
|
||||
{{- $categories = append $categories "Rezension" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Gedicht -}}
|
||||
{{- $categories = append $categories "Gedicht" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Aufsatz -}}
|
||||
{{- $categories = append $categories "Aufsatz" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Theaterkritik -}}
|
||||
{{- $categories = append $categories "Theaterkritik" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Brief -}}
|
||||
{{- $categories = append $categories "Brief" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Erzaehlung -}}
|
||||
{{- $categories = append $categories "Erzählung" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Kommentar -}}
|
||||
{{- $categories = append $categories "Kommentar" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Uebersetzung -}}
|
||||
{{- $categories = append $categories "Übersetzung" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Auszug -}}
|
||||
{{- $categories = append $categories "Auszug" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Replik -}}
|
||||
{{- $categories = append $categories "Replik" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Lokalnachrichten -}}
|
||||
{{- $categories = append $categories "Lokalnachrichten" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Lotterie -}}
|
||||
{{- $categories = append $categories "Lotterie" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Nachruf -}}
|
||||
{{- $categories = append $categories "Nachruf" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Weltnachrichten -}}
|
||||
{{- $categories = append $categories "Weltnachrichten" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.EinkommendeFremde -}}
|
||||
{{- $categories = append $categories "Einkommende Fremde" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Wechselkurse -}}
|
||||
{{- $categories = append $categories "Wechselkurse" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Buecher -}}
|
||||
{{- $categories = append $categories "Bücher" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Lokalanzeigen -}}
|
||||
{{- $categories = append $categories "Lokalanzeigen" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Vorladung -}}
|
||||
{{- $categories = append $categories "Vorladung" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.GelehrteNachrichten -}}
|
||||
{{- $categories = append $categories "Gelehrte Nachrichten" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Anzeige -}}
|
||||
{{- $categories = append $categories "Anzeige" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Proklamation -}}
|
||||
{{- $categories = append $categories "Proklamation" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Desertionsliste -}}
|
||||
{{- $categories = append $categories "Desertionsliste" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Notenblatt -}}
|
||||
{{- $categories = append $categories "Notenblatt" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Vorlesungsverzeichnis -}}
|
||||
{{- $categories = append $categories "Vorlesungsverzeichnis" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Abbildung -}}
|
||||
{{- $categories = append $categories "Abbildung" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Ineigenersache -}}
|
||||
{{- $categories = append $categories "In eigener Sache" -}}
|
||||
{{- end -}}
|
||||
{{- if $categoryFlags.Provinienz -}}
|
||||
{{- $categories = append $categories "Provinienz" -}}
|
||||
{{- end -}}
|
||||
{{- if eq (len $categories) 0 -}}
|
||||
{{- $categories = append $categories "Beitrag" -}}
|
||||
{{- end -}}
|
||||
{{- $categoryName := "" -}}
|
||||
{{- if eq (len $categories) 0 -}}
|
||||
{{- $categoryName = "Beitrag" -}}
|
||||
{{- else -}}
|
||||
{{- $sortedCategories := sortStrings $categories -}}
|
||||
{{- $categoryName = joinWithUnd $sortedCategories -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $existing := index $groupedByCategory $categoryName -}}
|
||||
{{- if $existing -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $categoryName (append $existing $p)) -}}
|
||||
{{- else -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $categoryName (slice $p)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 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">
|
||||
{{ $categoryName }}
|
||||
{{- /* Check for additional authors (non-current actor) */ -}}
|
||||
{{- $additionalAuthorIDs := slice -}}
|
||||
{{- range $_, $p := $categoryPieces -}}
|
||||
{{- range $agentref := $p.Item.AgentRefs -}}
|
||||
{{- if and (or (eq $agentref.Category "") (eq $agentref.Category "autor")) (ne $agentref.Ref $a.ID) -}}
|
||||
{{- $additionalAuthorIDs = append $additionalAuthorIDs $agentref.Ref -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- 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 }}
|
||||
{{- end -}}{{ ":" }}
|
||||
</span>
|
||||
{{- /* Show all citations for this category */ -}}
|
||||
{{- range $_, $p := $categoryPieces -}}
|
||||
{{- range $_, $issue := $p.Item.IssueRefs -}}
|
||||
{{ $issueData := GetIssue (printf "%d-%d" $issue.When.Year $issue.Nr) }}
|
||||
{{- $url := printf "/%s/%d" $issue.When $issue.Nr -}}
|
||||
{{- if $issue.Von -}}
|
||||
{{- if $issue.Beilage -}}
|
||||
{{- $url = printf "%s#beilage-%d-page-%d" $url $issue.Beilage $issue.Von -}}
|
||||
{{- else -}}
|
||||
{{- $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">
|
||||
{{- 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 -}}
|
||||
{{ $issue.When.Day }}.{{ $issue.When.Month }}.{{ $issue.When.Year }}/{{ $issue.Nr }}, S. {{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) }}-{{ $issue.Bis }}{{ end }}
|
||||
{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user