Added akteure endpoint

This commit is contained in:
Simon Martens
2024-12-27 21:26:45 +01:00
parent 86152bd46d
commit 60649ca2f4
7 changed files with 68 additions and 29 deletions

View File

@@ -72,3 +72,7 @@ func (p Person) String() string {
// Copilot: Please format and return all fields of the struct
return fmt.Sprintf("Person{KGPZID: %v, URL: %v, DateOfDeath: %v, PlaceOfDeath: %v, BiographicalOrHistoricalInformation: %v, PreferredName: %v, GndIdentifier: %v, Wikipedia: %v, Depiction: %v, ProfessionOrOccupation: %v, PreferredNameEntityForThePerson: %v, DateOfBirth: %v, PlaceOfBirth: %v, VariantNameEntityForThePerson: %v, VariantName: %v, SameAs: %v}", p.KGPZID, p.URL, p.DateOfDeath, p.PlaceOfDeath, p.BiographicalOrHistoricalInformation, p.PreferredName, p.GndIdentifier, p.Wikipedia, p.Depiction, p.ProfessionOrOccupation, p.PreferredNameEntityForThePerson, p.DateOfBirth, p.PlaceOfBirth, p.VariantNameEntityForThePerson, p.VariantName, p.SameAs)
}
func (p Person) Name() string {
return p.PreferredName
}

View File

@@ -62,6 +62,7 @@ func AgentsView(letterorid string, lib *xmlprovider.Library) *AgentsListView {
if ref, ok := w.ReferencesAgent(letterorid); ok {
if entry, ok := res.Agents[ref.Ref]; ok {
entry.Works = append(entry.Works, WorkByAgent{Work: w, Reference: *ref})
res.Agents[ref.Ref] = entry
}
}
}
@@ -72,6 +73,7 @@ func AgentsView(letterorid string, lib *xmlprovider.Library) *AgentsListView {
if ref, ok := p.ReferencesAgent(letterorid); ok {
if entry, ok := res.Agents[ref.Ref]; ok {
entry.Pieces = append(entry.Pieces, PieceByAgent{Piece: p, Reference: *ref})
res.Agents[ref.Ref] = entry
}
}
}

BIN
views/assets/GND.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
<div>
<div>Übersicht nach</div>
<a href="/">Jahrgängen</a>
<a href="/akteure/">Personen</a>
<a href="/akteure/a">Personen</a>
<a href="/kategorie/">Betragsarten</a>
<a href="/ort/">Orten</a>
</div>

BIN
views/public/GND.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -22,37 +22,70 @@
</div>
{{ range $_, $id := .model.Sorted }}
<div class="pb-4">
<a href="/akteure/{{ $id }}">
{{ $a := index $.model.Agents $id }}
{{ $a := index $.model.Agents $id }}
{{ if and $a (ne (len $a.Names) 0) }}
<div class="pb-4">
{{ index $a.Names 0 }}
</a>
<div>
{{ $gnd := GetGND $a.GND }}
{{ if and (ne $gnd nil) (ne $gnd.DateOfBirth nil) }}
{{- if ne (len $gnd.DateOfBirth) 0 -}}
<i class="ri-asterisk text-xs relative bottom-0.5"></i>&nbsp;
{{- HRDateShort (index $gnd.DateOfBirth 0) -}}
{{- end -}}
{{- if ne (len $gnd.DateOfDeath) 0 }}
&emsp;<i class="ri-cross-fill text-xs relative bottom-0.5"></i
>&nbsp;{{ HRDateShort (index $gnd.DateOfDeath 0) }}
<div>
{{ $gnd := GetGND $a.GND }}
{{ if (ne $gnd nil) }}
{{- if ne (len $gnd.DateOfBirth) 0 -}}
<i class="ri-asterisk text-xs relative bottom-0.5"></i>&nbsp;
{{- HRDateShort (index $gnd.DateOfBirth 0) -}}
{{- end -}}
{{- if ne (len $gnd.DateOfDeath) 0 }}
&emsp;<i class="ri-cross-fill text-xs relative bottom-0.5"></i
>&nbsp;{{ HRDateShort (index $gnd.DateOfDeath 0) }}
{{ end }}
{{- if ne (len $gnd.ProfessionOrOccupation) 0 -}}
<div>
{{- (index $gnd.ProfessionOrOccupation 0).Label -}}
{{- if gt (len $gnd.ProfessionOrOccupation) 1 -}}
,
{{ (index $gnd.ProfessionOrOccupation 1).Label -}}
{{ end -}}
{{- if gt (len $gnd.ProfessionOrOccupation) 2 -}}
,
{{ (index $gnd.ProfessionOrOccupation 2).Label -}}
{{ end -}}
</div>
{{ end }}
{{ end }}
{{- if ne (len $gnd.ProfessionOrOccupation) 0 -}}
<div>
{{- (index $gnd.ProfessionOrOccupation 0).Label -}}
{{- if gt (len $gnd.ProfessionOrOccupation) 1 -}}
,
{{ (index $gnd.ProfessionOrOccupation 1).Label -}}
<div class="flex gap-x-2 flex-row">
<a href="/akteure/{{ $id }}" class="!no-underline"><i class="ri-links-line"></i></a>
{{- if ne $gnd nil -}}
<a href="{{ $a.GND }}" target="_blank">GND &rarr;</a>
{{- if ne (len $gnd.Wikipedia) 0 -}}
<a href="{{ (index $gnd.Wikipedia 0).Label }}" target="_blank">WIKI &rarr;</a>
{{ end -}}
{{- if gt (len $gnd.ProfessionOrOccupation) 2 -}}
,
{{ (index $gnd.ProfessionOrOccupation 2).Label -}}
{{ end -}}
</div>
{{ end }}
{{ end }}
</div>
</div>
{{- if ne (len $a.Works) 0 -}}
<div>
{{ range $_, $w := $a.Works }}
{{- if ne (len $w.Citation.InnerXML ) 0 -}}
<div>
{{- $w.Citation.InnerXML -}}
</div>
{{- end -}}
{{ end }}
</div>
{{ end }}
{{- if ne (len $a.Pieces) 0 -}}
<div>
{{ range $_, $p := $a.Pieces }}
{{- range $_, $i := $p.IssueRefs -}}
<div>
<a href="/{{ $i.When }}/{{ $i.Nr }}">{{ $i.Nr }}/{{ $i.When }}</a>
</div>
{{- end -}}
{{ end }}
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ end }}