diff --git a/CLAUDE.md b/CLAUDE.md index e13e1a6..9233499 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -126,13 +126,16 @@ views/ │ │ ├── _akteur_header.gohtml # Agent name, dates, professions, links │ │ ├── _akteur_werke.gohtml # Works section with categorized pieces │ │ ├── _akteur_beitraege.gohtml # Contributions/pieces with grouping -│ │ └── _piece_summary.gohtml # Individual piece display logic +│ │ └── _unified_piece_entry.gohtml # Universal piece display component │ ├── datenschutz/ # Privacy policy │ ├── edition/ # Edition pages │ ├── filter/ # Quickfilter system │ ├── kategorie/ # Category pages │ ├── kontakt/ # Contact pages -│ ├── ort/ # Places pages +│ ├── ort/ # Places pages with overview/detail split +│ │ ├── overview/ # Places grid view (body.gohtml, head.gohtml) +│ │ ├── detail/ # Individual place view (body.gohtml, head.gohtml) +│ │ └── components/ # Place-specific components (_place_card, _place_header, _place_pieces, _back_navigation) │ ├── piece/ # Multi-issue piece pages │ │ └── components/ # Piece-specific components (_piece_inhaltsverzeichnis, _piece_sequential_layout) │ ├── search/ # Search pages @@ -193,6 +196,7 @@ Each route has dedicated `head.gohtml` and `body.gohtml` files following Go temp - **`issue.js`**: Newspaper layout, page navigation, modal functions, citation generation - **`single-page-viewer.js`**: SinglePageViewer web component for image modal display - **`scroll-to-top.js`**: ScrollToTopButton web component for floating scroll button +- **`places.js`**: PlacesFilter web component for real-time place search filtering **Build Process**: - **Source**: `transform/main.js` and `transform/site.css` @@ -950,4 +954,272 @@ type GeonamesPlace struct { - Case-insensitive name comparisons using `lower` template function - Proper handling of empty alternate names arrays - Safe string manipulation with whitespace control -- Consistent behavior across detail and overview templates \ No newline at end of file +- Consistent behavior across detail and overview templates + +## Unified Piece Entry System + +The application uses a centralized component for displaying newspaper pieces (Beiträge) consistently across all views, ensuring uniform citation formatting and category-dependent descriptions throughout the interface. + +### Core Component + +**Central Template** (`views/routes/components/_unified_piece_entry.gohtml`): +- Universal component for piece display across all view contexts +- Handles both `viewmodels.PieceByIssue` and `xmlmodels.Piece` data structures +- Contains comprehensive category-specific descriptions (29+ categories) +- Unified citation formatting and place tag generation +- Supports different display modes for various page contexts + +### Data Structure Handling + +**Multi-Type Support**: +```gohtml +{{- /* Handle different piece types */ -}} +{{- $piece := $pieceInput -}} +{{- $isContinuation := false -}} +{{- if eq $displayMode "issue" -}} + {{- $piece = $pieceInput.Piece -}} + {{- $isContinuation = $pieceInput.IsContinuation -}} +{{- end -}} +``` + +**Display Mode Parameters**: +- `issue` - For issue table of contents with continuation handling +- `piece` - For multi-issue piece views +- `place` - For place-associated pieces with colon format +- `akteure` - For agent/author contribution lists + +### Category-Dependent Descriptions + +**Comprehensive Category Support**: +- **Reviews**: "Rezension zu [work title]" with linked authors +- **Obituaries**: "Nachruf auf [person name]" with agent category detection +- **Advertisements**: "Anzeige" with multiple place support +- **Letters**: "Brief" with sender/recipient information +- **Announcements**: Category-specific formatting for each type +- **Academic**: "Dissertation", "Disputation", "Programm" with institutional context + +**Special Category Handling**: +```gohtml +{{- range $agentref := $piece.AgentRefs -}} + {{- if eq $agentref.Category "nachruf" -}} + {{- $agent := GetAgent $agentref.Ref -}} + Nachruf auf {{ index $agent.Names 0 }} + {{- end -}} +{{- end -}} +``` + +### Place Tag Integration + +**Clickable Place Links**: +- Automatic place tag generation for all pieces +- Links to place detail pages (`/ort/{id}`) +- Multiple place support for advertisements and events +- Conditional display based on piece category + +**Implementation**: +```gohtml +{{ if and (ne (len $piece.PlaceRefs) 0) $ShowPlaceTags }} + {{ range $index, $placeRef := $piece.PlaceRefs }} + {{ if gt $index 0 }}, {{ end }} + {{ $placeName }} + {{ end }} +{{ end }} +``` + +### Usage Across Views + +**Current Integration Points**: +- **Issue View** (`_inhaltsverzeichnis.gohtml`): Table of contents with continuation handling +- **Agent Views** (`_akteur_beitraege.gohtml`): Author contribution lists +- **Place Views** (`_place_pieces.gohtml`): Place-associated pieces +- **Piece Views** (`_piece_inhaltsverzeichnis.gohtml`): Multi-issue piece displays + +**Template Call Pattern**: +```gohtml +{{ template "_unified_piece_entry" (dict + "Piece" $piece + "DisplayMode" "issue" + "ShowPlaceTags" true + "UseColonFormat" false + "ShowContinuation" true +) }} +``` + +### Parameters & Configuration + +**Required Parameters**: +- `Piece` - The piece data structure (either type) +- `DisplayMode` - Context for formatting ("issue", "piece", "place", "akteure") + +**Optional Parameters**: +- `ShowPlaceTags` (bool) - Whether to display clickable place links +- `UseColonFormat` (bool) - Use colon separator for place-specific formatting +- `ShowContinuation` (bool) - Show continuation indicators for multi-part pieces +- `CurrentActorID` (string) - Exclude current agent from author links in agent views + +### Category Formatting Rules + +**Natural Language Descriptions**: +- Proper German grammar with gender-appropriate articles +- Work titles in italics with proper author attribution +- Place names as clickable tags when relevant +- Agent references with appropriate relationship indicators + +**Title Fallback Logic**: +1. Use piece title if available +2. Fall back to incipit (opening words) if no title +3. Generate category-specific description +4. Handle special cases (reviews, obituaries, advertisements) + +### Maintenance & Extension + +**Adding New Categories**: +1. Add new category case in the main conditional block +2. Implement category-specific description logic +3. Handle agent/place/work references as needed +4. Test across all view contexts + +**Modifying Display Logic**: +- Edit only `_unified_piece_entry.gohtml` +- Changes automatically apply to all views +- Test with different piece types and display modes +- Verify place tag and agent link functionality + +### Error Handling + +**Template Safety**: +- Null checks for all piece data fields +- Safe handling of missing titles, authors, or places +- Graceful fallback for unknown categories +- Type-safe access to different piece structures + +**Data Validation**: +- Proper handling of empty agent/place reference arrays +- Safe string manipulation and concatenation +- Conditional display based on data availability +- Consistent behavior across different piece types + +## Agent Relationship System + +The application handles complex relationships between agents (persons/organizations) and both works and pieces (Beiträge), with specific formatting for different contributor roles. + +### Contributor Categories + +**Supported Agent Categories**: +- **Empty/`"autor"`**: Primary authors (no special suffix) +- **`"übersetzer"`**: Translators - displayed with "(Übers.)" suffix +- **`"herausgeber"`**: Editors - displayed with "(Hrsg.)" suffix +- **`"nachruf"`**: Obituary subjects - special handling for "Nachruf auf [person]" + +### Work Relationships (`_akteur_werke.gohtml`) + +**Role Qualification in Works Bibliography**: +- Works display person's relationship to each work as a prefix +- **Authors**: No prefix (default relationship) +- **Translators**: `(Übers.) [Work Title]` +- **Editors**: `(Hrsg.) [Work Title]` + +**Example Output**: +``` +Werke +(Übers.) Herrn Johann Ludwigs Bianconi Zehn Sendschreiben an Herrn Marchese Philippo Hercolani... +Rezension: 1.2.1765/9, S. 33-34 + +Die Aufklärung der Philosophie (Leipzig: Breitkopf 1766) +Rezension: 1.5.1766/15, S. 45-48 +``` + +**Implementation Details**: +- Role detection via `$w.Item.AgentRefs` matching current person ID +- Prefix added before existing `Citation.HTML` content +- Break after finding person's role for performance +- Maintains all existing formatting and external links + +### Piece Relationships (Unified System) + +**Multi-Role Contributor Display**: +- Authors, translators, and editors can all contribute to single pieces +- Consistent formatting across all view contexts +- Proper comma separation and German conjunction handling + +**Display Patterns**: +``` +Author1, Author2, Translator1 (Übers.), Editor1 (Hrsg.): [Piece Content] +Schmidt (Übers.), Müller (Hrsg.): Rezension von: Goethe, Faust +Translator1 (Übers.): Übersetzung aus: Voltaire, Candide +``` + +**Work Citation Enhancement**: +- Work contributors shown with roles in piece citations +- Example: `Rezension von: Giovanni Lodovico Bianconi, Dorothea Henriette Runckel (Übers.), Zehn Sendschreiben` +- Maintains work author, translator, and editor relationships + +### Context-Sensitive Display + +**Agent Detail Pages** (`/akteure/{id}`): +- **Works Section**: Shows person's role as prefix `(Übers.)` or `(Hrsg.)` +- **Beiträge Section**: Groups pieces by title and contributors, shows other collaborators +- **Current Agent Exclusion**: Hides current person from contributor lists in their own page + +**Issue Views** (`/year/issue`): +- Full contributor display with all roles +- Shows piece authors, translators, and editors in table of contents +- Work citations include all work contributors with roles + +**Place Views** (`/ort/{id}`): +- Colon format: `Author (Übers.): [Content]` +- Regular format: `Author (Übers.), [Content]` +- Place-specific formatting for associated pieces + +**Multi-Issue Piece Views** (`/beitrag/{id}`): +- Consistent contributor display across issue boundaries +- Maintains role information in sequential display +- Work citations preserve contributor relationships + +### Technical Implementation + +**Variable Collections**: +```gohtml +{{- $authors := slice -}} +{{- $translators := slice -}} +{{- $editors := slice -}} +{{- range $agentref := $piece.AgentRefs -}} + {{- if eq $agentref.Category "übersetzer" -}} + {{- $translators = append $translators (dict "ID" $agentref.Ref "Name" $agentName) -}} + {{- else if eq $agentref.Category "herausgeber" -}} + {{- $editors = append $editors (dict "ID" $agentref.Ref "Name" $agentName) -}} + {{- end -}} +{{- end -}} +``` + +**Role Detection Logic**: +```gohtml +{{- range $workAgentRef := $work.AgentRefs -}} + {{- if eq $workAgentRef.Ref $currentPersonID -}} + {{- if eq $workAgentRef.Category "übersetzer" -}} + {{- $personRole = "(Übers.) " -}} + {{- else if eq $workAgentRef.Category "herausgeber" -}} + {{- $personRole = "(Hrsg.) " -}} + {{- end -}} + {{- end -}} +{{- end -}} +``` + +**Formatting Functions**: +- `joinWithUnd` - German conjunction for multiple contributors +- Current actor exclusion logic for agent detail pages +- Comma separation with proper spacing for role suffixes + +### Error Handling + +**Relationship Safety**: +- Graceful handling of missing agent references +- Safe access to agent data via `GetAgent` function +- Null checks for agent names and IDs +- Fallback display for unknown or malformed relationships + +**Performance Considerations**: +- Break statements after finding target relationships +- Efficient grouping by contributor combinations +- Minimal DOM manipulation for role prefixes +- Cached agent lookups where possible \ No newline at end of file diff --git a/views/routes/ausgabe/components/_inhaltsverzeichnis.gohtml b/views/routes/ausgabe/components/_inhaltsverzeichnis.gohtml index 33a4617..340e635 100644 --- a/views/routes/ausgabe/components/_inhaltsverzeichnis.gohtml +++ b/views/routes/ausgabe/components/_inhaltsverzeichnis.gohtml @@ -59,7 +59,7 @@ style="{{ if $individualPiece.PieceByIssue.IsContinuation }} display: none; {{ end }}"> - {{ template "_inhaltsverzeichnis_eintrag" $individualPiece.PieceByIssue }} + {{ template "_unified_piece_entry" (dict "Piece" $individualPiece.PieceByIssue "DisplayMode" "issue" "ShowPlaceTags" true "UseColonFormat" false "ShowContinuation" true) }} @@ -197,7 +197,7 @@ style="{{ if $individualPiece.PieceByIssue.IsContinuation }} display: none; {{ end }}"> - {{ template "_inhaltsverzeichnis_eintrag" $individualPiece.PieceByIssue }} + {{ template "_unified_piece_entry" (dict "Piece" $individualPiece.PieceByIssue "DisplayMode" "issue" "ShowPlaceTags" true "UseColonFormat" false "ShowContinuation" true) }} diff --git a/views/routes/components/_akteur_beitraege.gohtml b/views/routes/components/_akteur_beitraege.gohtml index 5c10195..fc28030 100644 --- a/views/routes/components/_akteur_beitraege.gohtml +++ b/views/routes/components/_akteur_beitraege.gohtml @@ -35,7 +35,7 @@
{{- /* Use first piece for display text */ -}} - {{ template "_piece_summary" (dict "Piece" (index $groupedItems 0).Item "CurrentActorID" $a.ID) }} + {{ template "_unified_piece_entry" (dict "Piece" (index $groupedItems 0).Item "CurrentActorID" $a.ID "DisplayMode" "akteure" "ShowPlaceTags" true "UseColonFormat" false "ShowContinuation" false) }} {{- /* Show all citations from all pieces in this group inline with commas */ -}} {{ " " }}{{- range $groupIndex, $groupItem := $groupedItems -}} diff --git a/views/routes/components/_akteur_werke.gohtml b/views/routes/components/_akteur_werke.gohtml index 4ed66cd..66aedf1 100644 --- a/views/routes/components/_akteur_werke.gohtml +++ b/views/routes/components/_akteur_werke.gohtml @@ -21,7 +21,19 @@
{{- if ne (len $w.Item.Citation.InnerXML ) 0 -}}
- {{- Safe $w.Item.Citation.HTML -}} + {{- /* Check person's role in this work */ -}} + {{- $personRole := "" -}} + {{- range $workAgentRef := $w.Item.AgentRefs -}} + {{- if eq $workAgentRef.Ref $a.ID -}} + {{- if eq $workAgentRef.Category "übersetzer" -}} + {{- $personRole = "(Übers.) " -}} + {{- else if eq $workAgentRef.Category "herausgeber" -}} + {{- $personRole = "(Hrsg.) " -}} + {{- end -}} + {{- break -}} + {{- end -}} + {{- end -}} + {{- Safe $personRole -}}{{- Safe $w.Item.Citation.HTML -}} {{- range $_, $url := $w.Item.URLs -}} @@ -70,18 +82,26 @@ {{- $categories = append $categories "Beitrag" -}} {{- end -}} - {{- /* Get authors for this piece (excluding current person) */ -}} + {{- /* Get authors, translators, and editors for this piece (excluding current person) */ -}} {{- $pieceAuthors := slice -}} + {{- $pieceTranslators := slice -}} + {{- $pieceEditors := slice -}} {{- range $agentref := $p.Item.AgentRefs -}} {{- if and (or (eq $agentref.Category "") (eq $agentref.Category "autor")) (ne $agentref.Ref $a.ID) -}} {{- $pieceAuthors = append $pieceAuthors $agentref.Ref -}} + {{- else if and (eq $agentref.Category "übersetzer") (ne $agentref.Ref $a.ID) -}} + {{- $pieceTranslators = append $pieceTranslators $agentref.Ref -}} + {{- else if and (eq $agentref.Category "herausgeber") (ne $agentref.Ref $a.ID) -}} + {{- $pieceEditors = append $pieceEditors $agentref.Ref -}} {{- end -}} {{- end -}} {{- $sortedAuthors := sortStrings $pieceAuthors -}} + {{- $sortedTranslators := sortStrings $pieceTranslators -}} + {{- $sortedEditors := sortStrings $pieceEditors -}} - {{- /* Create group key: categories + authors */ -}} + {{- /* Create group key: categories + authors + translators + editors */ -}} {{- $sortedCategories := sortStrings $categories -}} - {{- $groupKey := printf "%s|%s" (joinWithUnd $sortedCategories) (joinWithUnd $sortedAuthors) -}} + {{- $groupKey := printf "%s|%s|%s|%s" (joinWithUnd $sortedCategories) (joinWithUnd $sortedAuthors) (joinWithUnd $sortedTranslators) (joinWithUnd $sortedEditors) -}} {{- /* Add piece to group (check for duplicates by ID) */ -}} {{- $existing := index $pieceGroups $groupKey -}} @@ -104,10 +124,18 @@ {{- /* Display each group */ -}} {{- range $groupKey, $groupPieces := $pieceGroups -}}
- {{- /* Extract categories and authors from group key */ -}} + {{- /* Extract categories, authors, translators, and editors from group key */ -}} {{- $keyParts := split $groupKey "|" -}} {{- $categoryName := index $keyParts 0 -}} {{- $authorPart := index $keyParts 1 -}} + {{- $translatorPart := "" -}} + {{- if gt (len $keyParts) 2 -}} + {{- $translatorPart = index $keyParts 2 -}} + {{- end -}} + {{- $editorPart := "" -}} + {{- if gt (len $keyParts) 3 -}} + {{- $editorPart = index $keyParts 3 -}} + {{- end -}} {{- /* Use plural if multiple pieces grouped together */ -}} {{- $displayCategory := $categoryName -}} @@ -130,7 +158,39 @@ {{- $displayCategory = "Beiträge" -}} {{- end -}} {{- end -}} - {{ $displayCategory }}{{- if ne $authorPart "" }} von {{ range $i, $authorID := (split $authorPart " und ") }}{{- if gt $i 0 }} und {{ end }}{{- $agent := GetAgent $authorID -}}{{- if and $agent (gt (len $agent.Names) 0) -}}{{ index $agent.Names 0 }}{{- end -}}{{ end }}{{- end }}: + {{ $displayCategory }}{{- if or (ne $authorPart "") (ne $translatorPart "") (ne $editorPart "") }} von {{ end }} + {{- /* Display authors */ -}} + {{- if ne $authorPart "" -}} + {{- range $i, $authorID := (split $authorPart " und ") -}} + {{- if gt $i 0 }} und {{ end }} + {{- $agent := GetAgent $authorID -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{ index $agent.Names 0 }} + {{- end -}} + {{- end -}} + {{- end -}} + {{- /* Display translators with (Übers.) suffix */ -}} + {{- if ne $translatorPart "" -}} + {{- if ne $authorPart "" }}, {{ end }} + {{- range $i, $translatorID := (split $translatorPart " und ") -}} + {{- if gt $i 0 }}, {{ end }} + {{- $agent := GetAgent $translatorID -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{ index $agent.Names 0 }} (Übers.) + {{- end -}} + {{- end -}} + {{- end -}} + {{- /* Display editors with (Hrsg.) suffix */ -}} + {{- if ne $editorPart "" -}} + {{- if or (ne $authorPart "") (ne $translatorPart "") }}, {{ end }} + {{- range $i, $editorID := (split $editorPart " und ") -}} + {{- if gt $i 0 }}, {{ end }} + {{- $agent := GetAgent $editorID -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{ index $agent.Names 0 }} (Hrsg.) + {{- end -}} + {{- end -}} + {{- end -}}: {{- /* Show citations separated by commas */ -}} {{ " " }}{{- range $pieceIndex, $p := $groupPieces -}} {{- range $issueIndex, $issue := $p.Item.IssueRefs -}} diff --git a/views/routes/components/_inhaltsverzeichnis_eintrag.gohtml b/views/routes/components/_inhaltsverzeichnis_eintrag.gohtml deleted file mode 100644 index 36a28f6..0000000 --- a/views/routes/components/_inhaltsverzeichnis_eintrag.gohtml +++ /dev/null @@ -1,426 +0,0 @@ -{{- $piece := . -}} -{{- $fortsPrefix := "" -}} -{{- if $piece.IsContinuation -}} - {{- $fortsPrefix = "(Forts.) " -}} -{{- end -}} - - -
- {{- $categoryFlags := GetCategoryFlags $piece.Piece -}} - - {{- $place := "" -}} - {{- if $piece.PlaceRefs -}} - {{- $placeObj := GetPlace (index $piece.PlaceRefs 0).Ref -}} - {{- if gt (len $placeObj.Names) 0 -}} - {{- $place = index $placeObj.Names 0 -}} - {{- end -}} - {{- end -}} - - {{- $title := "" -}} - {{- if $piece.Title -}} - {{- $title = index $piece.Title 0 -}} - {{- else if $piece.Incipit -}} - {{- $title = index $piece.Incipit 0 -}} - {{- end -}} - - {{- $workTitle := "" -}} - {{- $workTitleFull := "" -}} - {{- $workAuthorName := "" -}} - {{- $workAuthorID := "" -}} - {{- if $piece.WorkRefs -}} - {{- $work := GetWork (index $piece.WorkRefs 0).Ref -}} - {{- /* Determine short title (PreferredTitle) and full title (Citation.Title) */ -}} - {{- if $work.PreferredTitle -}} - {{- $workTitle = $work.PreferredTitle -}} - {{- else if $work.Citation.Title -}} - {{- $workTitle = $work.Citation.Title -}} - {{- else if $work.Citation.Chardata -}} - {{- $workTitle = $work.Citation.Chardata -}} - {{- end -}} - {{- /* Always get full title for highlighted state */ -}} - {{- if $work.Citation.Title -}} - {{- $workTitleFull = $work.Citation.Title -}} - {{- else if $work.Citation.Chardata -}} - {{- $workTitleFull = $work.Citation.Chardata -}} - {{- else if $work.PreferredTitle -}} - {{- $workTitleFull = $work.PreferredTitle -}} - {{- end -}} - {{- /* Get work author */ -}} - {{- if $work.AgentRefs -}} - {{- range $workAgentRef := $work.AgentRefs -}} - {{- if (or (eq $workAgentRef.Category "") (eq $workAgentRef.Category "autor")) -}} - {{- $workAgent := GetAgent $workAgentRef.Ref -}} - {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} - {{- $workAuthorName = index $workAgent.Names 0 -}} - {{- $workAuthorID = $workAgentRef.Ref -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Generate natural text descriptions */ -}} - - {{- if $categoryFlags.Rezension -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, - Rezension von: - {{ if $workAuthorName }} - {{- if $workAuthorID -}} - {{ $workAuthorName }} - {{- else -}} - {{ $workAuthorName }} - {{- end -}}, - {{ end }} - {{ if $workTitle }} - {{ $workTitle }} - {{ else if $title }} - {{ $title }} - {{ else }} - [Werk unbekannt] - {{ end }}{{ if $place }} {{ $place }}{{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}Rezension von: - {{ if $workAuthorName }} - {{- if $workAuthorID -}} - {{ $workAuthorName }} - {{- else -}} - {{ $workAuthorName }} - {{- end -}}, - {{ end }} - {{ if $workTitle }} - {{ $workTitle }} - {{ else if $title }} - {{ $title }} - {{ else }} - [Werk unbekannt] - {{ end }}{{ if $place }} {{ $place }}{{ end }} - {{- end -}} - - {{- else if $categoryFlags.Weltnachrichten -}} - {{ Safe $fortsPrefix }}Politische Nachrichten aus aller Welt - {{- else if $categoryFlags.EinkommendeFremde -}} - {{- if $categoryFlags.Lokalnachrichten -}} - Lokale Meldungen über einreisende Fremde - {{- else if $categoryFlags.Nachruf -}} - Nachruf und Einreiseliste - {{- else -}} - Einreiseliste - {{- end -}}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Wechselkurse -}} - Wechselkurse{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Buecher -}} - Bücheranzeigen{{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Lokalanzeigen -}} - {{ if $categoryFlags.Nachruf }} - Todesanzeige - {{ else }} - Lokalanzeige - {{ end }}{{ if $title }}: {{ $title }}{{ end }}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Lokalnachrichten -}} - {{ if $categoryFlags.Lotterie }} - Lotterienachrichten - {{ else if $categoryFlags.Nachruf }} - Nachrufe - {{ else if $categoryFlags.Theaterkritik }} - Theaternachrichten - {{ else if $categoryFlags.Panegyrik }} - Festlichkeiten - {{ else }} - Lokalnachrichten - {{ end }}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Gedicht -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, - {{ if $categoryFlags.Kommentar }} - Gedicht mit Kommentar - {{ else if $categoryFlags.Uebersetzung }} - Gedichtübersetzung - {{ else if $categoryFlags.GelehrteNachrichten }} - Gedicht zu gelehrten Angelegenheiten - {{ else }} - Gedicht - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Kommentar }} - Gedicht mit Kommentar - {{ else if $categoryFlags.Uebersetzung }} - Gedichtübersetzung - {{ else if $categoryFlags.GelehrteNachrichten }} - Gedicht zu gelehrten Angelegenheiten - {{ else }} - Gedicht - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- end -}} - - {{- else if $categoryFlags.Vorladung -}} - Gerichtliche Vorladung{{ if $title }}: {{ $title }}{{ end }}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Aufsatz -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, - {{ if $categoryFlags.Replik }} - Erwiderung - {{ else if $categoryFlags.Uebersetzung }} - Übersetzung - {{ else if $categoryFlags.Nachruf }} - Nachruf - {{ else if $categoryFlags.Kommentar }} - Kommentar - {{ else if $categoryFlags.Rezepte }} - Rezepte und Anleitungen - {{ else }} - Aufsatz - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Replik }} - Erwiderung - {{ else if $categoryFlags.Uebersetzung }} - Übersetzung - {{ else if $categoryFlags.Nachruf }} - Nachruf - {{ else if $categoryFlags.Kommentar }} - Kommentar - {{ else if $categoryFlags.Rezepte }} - Rezepte und Anleitungen - {{ else }} - Aufsatz - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- end -}} - - {{- else if $categoryFlags.GelehrteNachrichten -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Theaterkritik }} - Theaterkritik - {{ else if $categoryFlags.Kommentar }} - Gelehrter Kommentar - {{ else }} - Gelehrte Nachrichten - {{ end }}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Theaterkritik -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, - Theaterkritik{{ if $workTitle }} - zu {{ $workTitle }}{{ if $workAuthorName }} - von - {{ $workAuthorName }} - {{ end }} - {{ else if $title }} - zu {{ $title }} - {{ end }}{{ if $place }} {{ $place }}{{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}Theaterkritik{{ if $workTitle }} - zu {{ $workTitle }}{{ if $workAuthorName }} - von {{ $workAuthorName }} - {{ end }} - {{ else if $title }} - zu {{ $title }} - {{ end }}{{ if $place }} {{ $place }}{{ end }} - {{- end -}} - - {{- else if $categoryFlags.Proklamation -}} - {{ Safe $fortsPrefix }}Amtliche - Proklamation{{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Ineigenersache -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Kommentar }} - {{ if $categoryFlags.Nachtrag }}Ergänzender Kommentar{{ else }}Redaktioneller Kommentar{{ end }} - {{ else if $categoryFlags.Replik }} - Redaktionelle Stellungnahme - {{ else }} - Anmerkung der Redaktion - {{ end }} - {{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Brief -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Nachruf }} - Kondolenzbrief - {{ else }} - Leserbrief - {{ end }} - {{- $authorFound := false -}}{{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}}{{- if and $agent (gt (len $agent.Names) 0) -}} - von - {{ index $agent.Names 0 }}{{- $authorFound = true -}}{{- break -}} - {{- end -}} - - {{- end -}} - - {{- end -}}{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Desertionsliste -}} - {{ Safe $fortsPrefix }}Desertionsliste{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Notenblatt -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Nachtrag }}Ergänztes{{ end }}Notenblatt{{ if $title }} - : {{ $title }} - {{ end }} - - {{- else if $categoryFlags.Vorlesungsverzeichnis -}} - {{ Safe $fortsPrefix }}Vorlesungsverzeichnis{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Erzaehlung -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, - {{ if $categoryFlags.Uebersetzung }} - Übersetzung einer Erzählung - {{ else }} - Erzählung - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Uebersetzung }} - Übersetzung einer Erzählung - {{ else }} - Erzählung - {{ end }}{{ if $title }}: „{{ $title }}"{{ end }} - {{- end -}} - - {{- else if $categoryFlags.Abbildung -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Aufsatz }} - Illustrierter Aufsatz - {{ else }} - Abbildung - {{ end }} - {{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Kriminalanzeige -}} - {{ Safe $fortsPrefix }}Kriminalanzeige{{ if $place }} {{ $place }}{{ end }} - - {{- else if $categoryFlags.Korrektur -}} - {{ Safe $fortsPrefix }}Korrektur{{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Anzeige -}} - {{ Safe $fortsPrefix }}{{ if $categoryFlags.Auszug }} - {{ if $categoryFlags.Gedicht }}Gedichtauszug{{ else }}Textauszug{{ end }} - {{ else }} - Anzeige - {{ end }} - {{ if $title }}: {{ $title }}{{ end }} - - {{- else if $categoryFlags.Auszug -}} - {{ Safe $fortsPrefix }}{{ if $title }}{{ $title }}, {{ end }}{{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ if $workAuthorName }} - {{ $workAuthorName }}, {{ end }}{{ if $workTitle }}{{ $workTitle }}{{ else if $title }}{{ $title }}{{ else }}[Werk unbekannt]{{ end }} - - {{- else -}} - {{- $authorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}{{ if $title }}: {{ $title }}{{ end }}{{ if $workTitle }} - {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} - {{ $workAuthorName }}, {{ end }}{{ $workTitle }} - {{ end }} - {{- $authorFound = true -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- if not $authorFound -}} - {{ Safe $fortsPrefix }}{{ if $title }}{{ $title }}{{ end }}{{ if $workTitle }} - {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} - {{ $workAuthorName }}, {{ end }}{{ $workTitle }} - {{ else if not $title }} - Beitrag ohne Titel - {{ end }} - {{- end -}} - - {{- end -}} -
- -{{- if not $piece.IsContinuation -}} - {{- range $annotation := $piece.AnnotationNote.Annotations -}} -
- {{ Safe $annotation.HTML }} -
- {{- end -}} -{{- end -}} diff --git a/views/routes/components/_piece_summary.gohtml b/views/routes/components/_piece_summary.gohtml deleted file mode 100644 index 5c7a616..0000000 --- a/views/routes/components/_piece_summary.gohtml +++ /dev/null @@ -1,204 +0,0 @@ -{{- $piece := .Piece -}} -{{- $currentActorID := .CurrentActorID -}} - - {{- $categoryFlags := GetCategoryFlags $piece -}} - - {{- $place := "" -}} - {{- if $piece.PlaceRefs -}} - {{- $placeObj := GetPlace (index $piece.PlaceRefs 0).Ref -}} - {{- if gt (len $placeObj.Names) 0 -}} - {{- $place = index $placeObj.Names 0 -}} - {{- end -}} - {{- end -}} - - {{- $title := "" -}} - {{- if $piece.Title -}} - {{- $title = index $piece.Title 0 -}} - {{- else if $piece.Incipit -}} - {{- $title = index $piece.Incipit 0 -}} - {{- end -}} - - {{- $workTitle := "" -}} - {{- $workAuthorName := "" -}} - {{- $workAuthorID := "" -}} - {{- if $piece.WorkRefs -}} - {{- $work := GetWork (index $piece.WorkRefs 0).Ref -}} - {{- if $work.PreferredTitle -}} - {{- $workTitle = $work.PreferredTitle -}} - {{- else if $work.Citation.Title -}} - {{- $workTitle = $work.Citation.Title -}} - {{- end -}} - {{- if $work.AgentRefs -}} - {{- range $workAgentRef := $work.AgentRefs -}} - {{- if (or (eq $workAgentRef.Category "") (eq $workAgentRef.Category "autor")) -}} - {{- $workAgent := GetAgent $workAgentRef.Ref -}} - {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} - {{- $workAuthorName = index $workAgent.Names 0 -}} - {{- $workAuthorID = $workAgentRef.Ref -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Build category list */ -}} - {{- $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 -}} - - {{- /* Display category combination */ -}} - {{- $categoryName := "" -}} - {{- if eq (len $categories) 0 -}} - {{- $categoryName = "Beitrag" -}} - {{- else -}} - {{- $sortedCategories := sortStrings $categories -}} - {{- $categoryName = joinWithUnd $sortedCategories -}} - {{- end -}} - - {{- /* Generate piece descriptions */ -}} - {{- if has $categories "Rezension" -}} - {{- /* Collect all additional authors (not current actor) */ -}} - {{- $additionalAuthors := slice -}} - {{- $currentAuthorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{- if ne $agentref.Ref $currentActorID -}} - {{- $additionalAuthors = append $additionalAuthors $agent -}} - {{- else -}} - {{- $currentAuthorFound = true -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Display review with proper author attribution */ -}} - {{- if $additionalAuthors -}} - mit {{ range $i, $author := $additionalAuthors }}{{- if gt $i 0 }} und {{ end }}{{ index $author.Names 0 }}{{ end }}, {{ $categoryName }} von: - {{- else if $currentAuthorFound -}} - {{ $categoryName }} von: - {{- else -}} - {{ $categoryName }} von: - {{- end -}} - {{ if $workAuthorName }} - {{ $workAuthorName }}, - {{ end }} - {{ if $workTitle }} - {{ $workTitle }} - {{ else if $title }} - {{ $title }} - {{ else }} - [Werk unbekannt] - {{ end }} - - {{- else -}} - {{- /* Collect all additional authors (not current actor) */ -}} - {{- $additionalAuthors := slice -}} - {{- $currentAuthorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{- if ne $agentref.Ref $currentActorID -}} - {{- $additionalAuthors = append $additionalAuthors $agent -}} - {{- else -}} - {{- $currentAuthorFound = true -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Display with proper author attribution */ -}} - {{- if $additionalAuthors -}} - mit {{ range $i, $author := $additionalAuthors }}{{- if gt $i 0 }} und {{ end }}{{ index $author.Names 0 }}{{ end }}, {{ $categoryName }}{{ if $title }}: {{ $title }}{{ end }} - {{- else if $currentAuthorFound -}} - {{ $categoryName }}{{ if $title }}: {{ $title }}{{ end }} - {{- else -}} - {{ $categoryName }}{{ if $title }}: {{ $title }}{{ else if eq $categoryName "Beitrag" }} ohne Titel{{ end }} - {{- end -}} - {{- end -}} - diff --git a/views/routes/components/_piece_summary_for_place.gohtml b/views/routes/components/_piece_summary_for_place.gohtml deleted file mode 100644 index 85b8bd6..0000000 --- a/views/routes/components/_piece_summary_for_place.gohtml +++ /dev/null @@ -1,203 +0,0 @@ -{{- $piece := .Piece -}} -{{- $currentActorID := .CurrentActorID -}} - - {{- $categoryFlags := GetCategoryFlags $piece -}} - - {{- $place := "" -}} - {{- if $piece.PlaceRefs -}} - {{- $placeObj := GetPlace (index $piece.PlaceRefs 0).Ref -}} - {{- if gt (len $placeObj.Names) 0 -}} - {{- $place = index $placeObj.Names 0 -}} - {{- end -}} - {{- end -}} - - {{- $title := "" -}} - {{- if $piece.Title -}} - {{- $title = index $piece.Title 0 -}} - {{- else if $piece.Incipit -}} - {{- $title = index $piece.Incipit 0 -}} - {{- end -}} - - {{- $workTitle := "" -}} - {{- $workAuthorName := "" -}} - {{- $workAuthorID := "" -}} - {{- if $piece.WorkRefs -}} - {{- $work := GetWork (index $piece.WorkRefs 0).Ref -}} - {{- if $work.PreferredTitle -}} - {{- $workTitle = $work.PreferredTitle -}} - {{- else if $work.Citation.Title -}} - {{- $workTitle = $work.Citation.Title -}} - {{- end -}} - {{- if $work.AgentRefs -}} - {{- range $workAgentRef := $work.AgentRefs -}} - {{- if (or (eq $workAgentRef.Category "") (eq $workAgentRef.Category "autor")) -}} - {{- $workAgent := GetAgent $workAgentRef.Ref -}} - {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} - {{- $workAuthorName = index $workAgent.Names 0 -}} - {{- $workAuthorID = $workAgentRef.Ref -}} - {{- break -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Build category list */ -}} - {{- $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 -}} - - {{- /* Display category combination */ -}} - {{- $categoryName := "" -}} - {{- if eq (len $categories) 0 -}} - {{- $categoryName = "Beitrag" -}} - {{- else -}} - {{- $sortedCategories := sortStrings $categories -}} - {{- $categoryName = joinWithUnd $sortedCategories -}} - {{- end -}} - - {{- /* Generate piece descriptions */ -}} - {{- if has $categories "Rezension" -}} - {{- /* Collect all additional authors (not current actor) */ -}} - {{- $additionalAuthors := slice -}} - {{- $currentAuthorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{- if ne $agentref.Ref $currentActorID -}} - {{- $additionalAuthors = append $additionalAuthors $agent -}} - {{- else -}} - {{- $currentAuthorFound = true -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Display review with colon instead of "mit" for place view */ -}} - {{- if $additionalAuthors -}} - {{ range $i, $author := $additionalAuthors }}{{- if gt $i 0 }} und {{ end }}{{ index $author.Names 0 }}{{ end }}: {{ $categoryName }} von: - {{- else if $currentAuthorFound -}} - {{ $categoryName }} von: - {{- else -}} - {{ $categoryName }} von: - {{- end -}} - {{ if $workAuthorName }} - {{ $workAuthorName }}, - {{ end }} - {{ if $workTitle }} - {{ $workTitle }} - {{ else if $title }} - {{ $title }} - {{ else }} - [Werk unbekannt] - {{ end }} - - {{- else -}} - {{- /* Collect all additional authors (not current actor) */ -}} - {{- $additionalAuthors := slice -}} - {{- $currentAuthorFound := false -}} - {{- range $agentref := $piece.AgentRefs -}} - {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} - {{- $agent := GetAgent $agentref.Ref -}} - {{- if and $agent (gt (len $agent.Names) 0) -}} - {{- if ne $agentref.Ref $currentActorID -}} - {{- $additionalAuthors = append $additionalAuthors $agent -}} - {{- else -}} - {{- $currentAuthorFound = true -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - - {{- /* Display with colon instead of "mit" for place view */ -}} - {{- if $additionalAuthors -}} - {{ range $i, $author := $additionalAuthors }}{{- if gt $i 0 }} und {{ end }}{{ index $author.Names 0 }}{{ end }}: {{ $categoryName }}{{ if $title }}: {{ $title }}{{ end }} - {{- else if $currentAuthorFound -}} - {{ $categoryName }}{{ if $title }}: {{ $title }}{{ end }} - {{- else -}} - {{ $categoryName }}{{ if $title }}: {{ $title }}{{ else if eq $categoryName "Beitrag" }} ohne Titel{{ end }} - {{- end -}} - {{- end -}} \ No newline at end of file diff --git a/views/routes/components/_unified_piece_entry.gohtml b/views/routes/components/_unified_piece_entry.gohtml new file mode 100644 index 0000000..c5f53d6 --- /dev/null +++ b/views/routes/components/_unified_piece_entry.gohtml @@ -0,0 +1,615 @@ +{{- /* + Unified Piece Entry Component + Displays piece entries with category-specific descriptions across all views + + Usage: {{ template "_unified_piece_entry" (dict + "Piece" $piece + "CurrentActorID" $currentActorID + "DisplayMode" "issue|akteure|place|search" + "ShowPlaceTags" true|false + "UseColonFormat" true|false + "ShowContinuation" true|false + ) }} + + Parameters: + - Piece: The piece object to display + - CurrentActorID: ID of current actor (for akteure view context) + - DisplayMode: Context for formatting ("issue", "akteure", "place", "search") + - ShowPlaceTags: Whether to show place tags (default: true) + - UseColonFormat: Use colon format instead of "mit" for place view (default: false) + - ShowContinuation: Show continuation prefixes (default: true for issue mode) +*/ -}} + +{{- $pieceInput := .Piece -}} +{{- $currentActorID := .CurrentActorID -}} +{{- $displayMode := .DisplayMode -}} +{{- if not $displayMode -}}{{ $displayMode = "issue" }}{{- end -}} +{{- $showPlaceTags := .ShowPlaceTags -}} +{{- if eq $showPlaceTags nil -}}{{ $showPlaceTags = true }}{{- end -}} +{{- $useColonFormat := .UseColonFormat -}} +{{- if eq $useColonFormat nil -}}{{ $useColonFormat = false }}{{- end -}} +{{- $showContinuation := .ShowContinuation -}} +{{- if eq $showContinuation nil -}}{{ $showContinuation = (eq $displayMode "issue") }}{{- end -}} + +{{- /* Handle different piece types: viewmodels.PieceByIssue vs xmlmodels.Piece */ -}} +{{- $piece := $pieceInput -}} +{{- $isContinuation := false -}} +{{- if eq $displayMode "issue" -}} + {{- /* Issue view uses viewmodels.PieceByIssue with .Piece field */ -}} + {{- $piece = $pieceInput.Piece -}} + {{- $isContinuation = $pieceInput.IsContinuation -}} +{{- end -}} + +{{- $fortsPrefix := "" -}} +{{- if and $showContinuation $isContinuation -}} + {{- $fortsPrefix = "(Forts.) " -}} +{{- end -}} + +
+ {{- $categoryFlags := GetCategoryFlags $piece -}} + + {{- $place := "" -}} + {{- $placeID := "" -}} + {{- if $piece.PlaceRefs -}} + {{- $placeObj := GetPlace (index $piece.PlaceRefs 0).Ref -}} + {{- if gt (len $placeObj.Names) 0 -}} + {{- $place = index $placeObj.Names 0 -}} + {{- $placeID = $placeObj.ID -}} + {{- end -}} + {{- end -}} + + {{- $title := "" -}} + {{- if $piece.Title -}} + {{- $title = index $piece.Title 0 -}} + {{- else if $piece.Incipit -}} + {{- $title = index $piece.Incipit 0 -}} + {{- end -}} + + {{- $workTitle := "" -}} + {{- $workTitleFull := "" -}} + {{- $workAuthorName := "" -}} + {{- $workAuthorID := "" -}} + {{- /* Initialize work contributor collections */ -}} + {{- $workAuthors := slice -}} + {{- $workTranslators := slice -}} + {{- $workEditors := slice -}} + {{- if $piece.WorkRefs -}} + {{- $work := GetWork (index $piece.WorkRefs 0).Ref -}} + {{- /* Determine short title (PreferredTitle) and full title (Citation.Title) */ -}} + {{- if $work.PreferredTitle -}} + {{- $workTitle = $work.PreferredTitle -}} + {{- else if $work.Citation.Title -}} + {{- $workTitle = $work.Citation.Title -}} + {{- else if $work.Citation.Chardata -}} + {{- $workTitle = $work.Citation.Chardata -}} + {{- end -}} + {{- /* Always get full title for highlighted state */ -}} + {{- if $work.Citation.Title -}} + {{- $workTitleFull = $work.Citation.Title -}} + {{- else if $work.Citation.Chardata -}} + {{- $workTitleFull = $work.Citation.Chardata -}} + {{- else if $work.PreferredTitle -}} + {{- $workTitleFull = $work.PreferredTitle -}} + {{- end -}} + {{- /* Get work contributors: authors, translators, editors */ -}} + {{- if $work.AgentRefs -}} + {{- range $workAgentRef := $work.AgentRefs -}} + {{- if (or (eq $workAgentRef.Category "") (eq $workAgentRef.Category "autor")) -}} + {{- $workAgent := GetAgent $workAgentRef.Ref -}} + {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} + {{- $workAuthors = append $workAuthors (dict "ID" $workAgentRef.Ref "Name" (index $workAgent.Names 0)) -}} + {{- end -}} + {{- else if eq $workAgentRef.Category "übersetzer" -}} + {{- $workAgent := GetAgent $workAgentRef.Ref -}} + {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} + {{- $workTranslators = append $workTranslators (dict "ID" $workAgentRef.Ref "Name" (index $workAgent.Names 0)) -}} + {{- end -}} + {{- else if eq $workAgentRef.Category "herausgeber" -}} + {{- $workAgent := GetAgent $workAgentRef.Ref -}} + {{- if and $workAgent (gt (len $workAgent.Names) 0) -}} + {{- $workEditors = append $workEditors (dict "ID" $workAgentRef.Ref "Name" (index $workAgent.Names 0)) -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- /* Legacy single author variables for compatibility */ -}} + {{- if gt (len $workAuthors) 0 -}} + {{- $workAuthorName = (index $workAuthors 0).Name -}} + {{- $workAuthorID = (index $workAuthors 0).ID -}} + {{- end -}} + {{- end -}} + + {{- /* Place tags helper - handle multiple places */ -}} + {{- $placeTag := "" -}} + {{- if and $showPlaceTags $piece.PlaceRefs -}} + {{- range $placeRef := $piece.PlaceRefs -}} + {{- $placeObj := GetPlace $placeRef.Ref -}} + {{- if gt (len $placeObj.Names) 0 -}} + {{- $placeName := index $placeObj.Names 0 -}} + {{- $placeTag = printf "%s %s" $placeTag $placeObj.ID $placeName -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- /* Author prefix for colon format (place view) */ -}} + {{- $colonPrefix := "" -}} + {{- if $useColonFormat -}} + {{- $colonPrefix = ": " -}} + {{- else -}} + {{- $colonPrefix = " mit " -}} + {{- end -}} + + {{- /* Collect authors, translators, and editors */ -}} + {{- $authors := slice -}} + {{- $translators := slice -}} + {{- $editors := slice -}} + {{- range $agentref := $piece.AgentRefs -}} + {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- $authors = append $authors (dict "ID" $agentref.Ref "Name" (index $agent.Names 0)) -}} + {{- end -}} + {{- else if eq $agentref.Category "übersetzer" -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- $translators = append $translators (dict "ID" $agentref.Ref "Name" (index $agent.Names 0)) -}} + {{- end -}} + {{- else if eq $agentref.Category "herausgeber" -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- $editors = append $editors (dict "ID" $agentref.Ref "Name" (index $agent.Names 0)) -}} + {{- end -}} + {{- end -}} + {{- end -}} + + + {{- /* Generate category-specific descriptions */ -}} + + {{- if $categoryFlags.Rezension -}} + {{- /* Show authors, translators, and editors in prefix */ -}} + {{- if or (gt (len $authors) 0) (gt (len $translators) 0) (gt (len $editors) 0) -}} + {{- $hasCurrentActorAuthor := false -}} + {{- range $author := $authors -}} + {{- if eq $author.ID $currentActorID -}} + {{- $hasCurrentActorAuthor = true -}} + {{- end -}} + {{- end -}} + {{- $hasCurrentActorTranslator := false -}} + {{- range $translator := $translators -}} + {{- if eq $translator.ID $currentActorID -}} + {{- $hasCurrentActorTranslator = true -}} + {{- end -}} + {{- end -}} + {{- $hasCurrentActorEditor := false -}} + {{- range $editor := $editors -}} + {{- if eq $editor.ID $currentActorID -}} + {{- $hasCurrentActorEditor = true -}} + {{- end -}} + {{- end -}} + {{- /* Show other authors/translators/editors in prefix */ -}} + {{- if and $useColonFormat (or (not $hasCurrentActorAuthor) (not $hasCurrentActorTranslator) (not $hasCurrentActorEditor)) -}} + {{ Safe $fortsPrefix }} + {{- $authorElements := slice -}} + {{- range $author := $authors -}} + {{- if ne $author.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s" $author.ID $author.Name) -}} + {{- end -}} + {{- end -}} + {{- range $translator := $translators -}} + {{- if ne $translator.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Übers.)" $translator.ID $translator.Name) -}} + {{- end -}} + {{- end -}} + {{- range $editor := $editors -}} + {{- if ne $editor.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Hrsg.)" $editor.ID $editor.Name) -}} + {{- end -}} + {{- end -}} + {{- range $index, $element := $authorElements -}} + {{- if gt $index 0 }}, {{ end }}{{ Safe $element }} + {{- end -}}{{ $colonPrefix }}Rezension von: + {{- else if not $useColonFormat -}} + {{ Safe $fortsPrefix }} + {{- $authorElements := slice -}} + {{- range $author := $authors -}} + {{- if ne $author.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s" $author.ID $author.Name) -}} + {{- end -}} + {{- end -}} + {{- range $translator := $translators -}} + {{- if ne $translator.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Übers.)" $translator.ID $translator.Name) -}} + {{- end -}} + {{- end -}} + {{- range $editor := $editors -}} + {{- if ne $editor.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Hrsg.)" $editor.ID $editor.Name) -}} + {{- end -}} + {{- end -}} + {{- range $index, $element := $authorElements -}} + {{- if gt $index 0 }}, {{ end }}{{ Safe $element }} + {{- end -}}, + {{- else -}} + {{ Safe $fortsPrefix }}Rezension von: + {{- end -}} + {{- else -}} + {{ Safe $fortsPrefix }}Rezension von: + {{- end -}} + + {{ if or (gt (len $workAuthors) 0) (gt (len $workTranslators) 0) (gt (len $workEditors) 0) }} + {{- /* Display work authors */ -}} + {{- range $index, $author := $workAuthors -}} + {{- if gt $index 0 }}, {{ end }} + {{ $author.Name }} + {{- end -}} + {{- /* Display work translators */ -}} + {{- if gt (len $workTranslators) 0 -}} + {{- if gt (len $workAuthors) 0 }}, {{ end }} + {{- range $index, $translator := $workTranslators -}} + {{- if gt $index 0 }}, {{ end }} + {{ $translator.Name }} (Übers.) + {{- end -}} + {{- end -}} + {{- /* Display work editors */ -}} + {{- if gt (len $workEditors) 0 -}} + {{- if or (gt (len $workAuthors) 0) (gt (len $workTranslators) 0) }}, {{ end }} + {{- range $index, $editor := $workEditors -}} + {{- if gt $index 0 }}, {{ end }} + {{ $editor.Name }} (Hrsg.) + {{- end -}} + {{- end -}}, + {{ end }} + {{ if $workTitle }} + {{ $workTitle }} + {{ else if $title }} + {{ $title }} + {{ else }} + [Werk unbekannt] + {{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Weltnachrichten -}} + {{ Safe $fortsPrefix }}Politische Nachrichten aus aller Welt{{ Safe $placeTag }} + + {{- else if $categoryFlags.EinkommendeFremde -}} + {{- if $categoryFlags.Lokalnachrichten -}} + {{ Safe $fortsPrefix }}Lokale Meldungen über einreisende Fremde + {{- else if $categoryFlags.Nachruf -}} + {{ Safe $fortsPrefix }}Nachruf und Einreiseliste + {{- else -}} + {{ Safe $fortsPrefix }}Einreiseliste + {{- end -}}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Wechselkurse -}} + {{ Safe $fortsPrefix }}Wechselkurse{{ Safe $placeTag }} + + {{- else if $categoryFlags.Buecher -}} + {{ Safe $fortsPrefix }}Bücheranzeigen{{ if $title }}: {{ $title }}{{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Lokalanzeigen -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Nachruf }} + Todesanzeige + {{ else }} + Lokalanzeige + {{ end }}{{ if $title }}: {{ $title }}{{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Lokalnachrichten -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Lotterie }} + Lotterienachrichten + {{ else if $categoryFlags.Nachruf }} + Nachrufe + {{ else if $categoryFlags.Theaterkritik }} + Theaternachrichten + {{ else if $categoryFlags.Panegyrik }} + Festlichkeiten + {{ else }} + Lokalnachrichten + {{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Gedicht -}} + {{- $authorFound := false -}} + {{- range $agentref := $piece.AgentRefs -}} + {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- if and $useColonFormat (ne $agentref.Ref $currentActorID) -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}{{ $colonPrefix }} + {{- else if not $useColonFormat -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, + {{- else -}} + {{ Safe $fortsPrefix }} + {{- end -}} + {{ if $categoryFlags.Kommentar }} + Gedicht mit Kommentar + {{ else if $categoryFlags.Uebersetzung }} + Gedichtübersetzung + {{ else if $categoryFlags.GelehrteNachrichten }} + Gedicht zu gelehrten Angelegenheiten + {{ else }} + Gedicht + {{ end }}{{ if $title }}: „{{ $title }}"{{ end }}{{ Safe $placeTag }} + {{- $authorFound = true -}} + {{- break -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if not $authorFound -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Kommentar }} + Gedicht mit Kommentar + {{ else if $categoryFlags.Uebersetzung }} + Gedichtübersetzung + {{ else if $categoryFlags.GelehrteNachrichten }} + Gedicht zu gelehrten Angelegenheiten + {{ else }} + Gedicht + {{ end }}{{ if $title }}: „{{ $title }}"{{ end }}{{ Safe $placeTag }} + {{- end -}} + + {{- else if $categoryFlags.Vorladung -}} + {{ Safe $fortsPrefix }}Gerichtliche Vorladung{{ if $title }}: {{ $title }}{{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Aufsatz -}} + {{- $authorFound := false -}} + {{- range $agentref := $piece.AgentRefs -}} + {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- if and $useColonFormat (ne $agentref.Ref $currentActorID) -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}{{ $colonPrefix }} + {{- else if not $useColonFormat -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, + {{- else -}} + {{ Safe $fortsPrefix }} + {{- end -}} + {{ if $categoryFlags.Replik }} + Erwiderung + {{ else if $categoryFlags.Uebersetzung }} + Übersetzung + {{ else if $categoryFlags.Nachruf }} + Nachruf + {{ else if $categoryFlags.Kommentar }} + Kommentar + {{ else if $categoryFlags.Rezepte }} + Rezepte und Anleitungen + {{ else }} + Aufsatz + {{ end }}{{ if $title }}: „{{ $title }}"{{ end }}{{ Safe $placeTag }} + {{- $authorFound = true -}} + {{- break -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if not $authorFound -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Replik }} + Erwiderung + {{ else if $categoryFlags.Uebersetzung }} + Übersetzung + {{ else if $categoryFlags.Nachruf }} + Nachruf + {{ else if $categoryFlags.Kommentar }} + Kommentar + {{ else if $categoryFlags.Rezepte }} + Rezepte und Anleitungen + {{ else }} + Aufsatz + {{ end }}{{ if $title }}: „{{ $title }}"{{ end }}{{ Safe $placeTag }} + {{- end -}} + + {{- else if $categoryFlags.GelehrteNachrichten -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Theaterkritik }} + Theaterkritik + {{ else if $categoryFlags.Kommentar }} + Gelehrter Kommentar + {{ else }} + Gelehrte Nachrichten + {{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Theaterkritik -}} + {{- $authorFound := false -}} + {{- range $agentref := $piece.AgentRefs -}} + {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- if and $useColonFormat (ne $agentref.Ref $currentActorID) -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}{{ $colonPrefix }} + {{- else if not $useColonFormat -}} + {{ Safe $fortsPrefix }}{{ index $agent.Names 0 }}, + {{- else -}} + {{ Safe $fortsPrefix }} + {{- end -}} + Theaterkritik{{ if $workTitle }} + zu {{ $workTitle }}{{ if $workAuthorName }} + von + {{ $workAuthorName }} + {{ end }} + {{ else if $title }} + zu {{ $title }} + {{ end }}{{ Safe $placeTag }} + {{- $authorFound = true -}} + {{- break -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if not $authorFound -}} + {{ Safe $fortsPrefix }}Theaterkritik{{ if $workTitle }} + zu {{ $workTitle }}{{ if $workAuthorName }} + von {{ $workAuthorName }} + {{ end }} + {{ else if $title }} + zu {{ $title }} + {{ end }}{{ Safe $placeTag }} + {{- end -}} + + {{- else if $categoryFlags.Proklamation -}} + {{ Safe $fortsPrefix }}Amtliche Proklamation{{ if $title }}: {{ $title }}{{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Ineigenersache -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Kommentar }} + {{ if $categoryFlags.Nachtrag }}Ergänzender Kommentar{{ else }}Redaktioneller Kommentar{{ end }} + {{ else if $categoryFlags.Replik }} + Redaktionelle Stellungnahme + {{ else }} + Anmerkung der Redaktion + {{ end }} + {{ if $title }}: {{ $title }}{{ end }}{{ Safe $placeTag }} + + {{- else if $categoryFlags.Brief -}} + {{ Safe $fortsPrefix }}{{ if $categoryFlags.Nachruf }} + Kondolenzbrief + {{ else }} + Leserbrief + {{ end }} + {{- $authorFound := false -}}{{- range $agentref := $piece.AgentRefs -}} + {{- if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) -}} + {{- $agent := GetAgent $agentref.Ref -}}{{- if and $agent (gt (len $agent.Names) 0) -}} + von + {{ index $agent.Names 0 }}{{- $authorFound = true -}}{{- break -}} + {{- end -}} + {{- end -}} + {{- end -}}{{ Safe $placeTag }} + + {{- else -}} + {{- /* Check for Nachruf category in AgentRefs first */ -}} + {{- $obituaryPersonFound := false -}} + {{- range $agentref := $piece.AgentRefs -}} + {{- if eq $agentref.Category "nachruf" -}} + {{- $agent := GetAgent $agentref.Ref -}} + {{- if and $agent (gt (len $agent.Names) 0) -}} + {{- if not $obituaryPersonFound -}} + {{ Safe $fortsPrefix }}Nachruf auf + {{- else -}} + , + {{- end -}} + {{ index $agent.Names 0 }} + {{- $obituaryPersonFound = true -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if $obituaryPersonFound -}} + {{ Safe $placeTag }} + {{- else -}} + {{- /* Default handling for pieces without special categories */ -}} + {{- if or (gt (len $authors) 0) (gt (len $translators) 0) (gt (len $editors) 0) -}} + {{- $hasCurrentActorAuthor := false -}} + {{- range $author := $authors -}} + {{- if eq $author.ID $currentActorID -}} + {{- $hasCurrentActorAuthor = true -}} + {{- end -}} + {{- end -}} + {{- $hasCurrentActorTranslator := false -}} + {{- range $translator := $translators -}} + {{- if eq $translator.ID $currentActorID -}} + {{- $hasCurrentActorTranslator = true -}} + {{- end -}} + {{- end -}} + {{- $hasCurrentActorEditor := false -}} + {{- range $editor := $editors -}} + {{- if eq $editor.ID $currentActorID -}} + {{- $hasCurrentActorEditor = true -}} + {{- end -}} + {{- end -}} + {{- /* Show other authors/translators/editors in prefix */ -}} + {{- if and $useColonFormat (or (not $hasCurrentActorAuthor) (not $hasCurrentActorTranslator) (not $hasCurrentActorEditor)) -}} + {{ Safe $fortsPrefix }} + {{- $authorElements := slice -}} + {{- range $author := $authors -}} + {{- if ne $author.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s" $author.ID $author.Name) -}} + {{- end -}} + {{- end -}} + {{- range $translator := $translators -}} + {{- if ne $translator.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Übers.)" $translator.ID $translator.Name) -}} + {{- end -}} + {{- end -}} + {{- range $editor := $editors -}} + {{- if ne $editor.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Hrsg.)" $editor.ID $editor.Name) -}} + {{- end -}} + {{- end -}} + {{- range $index, $element := $authorElements -}} + {{- if gt $index 0 }}, {{ end }}{{ Safe $element }} + {{- end -}}{{ $colonPrefix }} + {{- else if not $useColonFormat -}} + {{ Safe $fortsPrefix }} + {{- $authorElements := slice -}} + {{- range $author := $authors -}} + {{- if ne $author.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s" $author.ID $author.Name) -}} + {{- end -}} + {{- end -}} + {{- range $translator := $translators -}} + {{- if ne $translator.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Übers.)" $translator.ID $translator.Name) -}} + {{- end -}} + {{- end -}} + {{- range $editor := $editors -}} + {{- if ne $editor.ID $currentActorID -}} + {{- $authorElements = append $authorElements (printf "%s (Hrsg.)" $editor.ID $editor.Name) -}} + {{- end -}} + {{- end -}} + {{- range $index, $element := $authorElements -}} + {{- if gt $index 0 }}, {{ end }}{{ Safe $element }} + {{- end -}} + {{- if gt (len $authorElements) 0 -}} + {{- if $title }}: {{ $title }}{{ end }}{{ if $workTitle }} + {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} + {{ $workAuthorName }}, {{ end }}{{ $workTitle }} + {{ end }} + {{- else -}} + {{- if $title }}{{ $title }}{{ end }}{{ if $workTitle }} + {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} + {{ $workAuthorName }}, {{ end }}{{ $workTitle }} + {{ end }} + {{- end -}}{{ Safe $placeTag }} + {{- else -}} + {{ Safe $fortsPrefix }}{{ if $title }}{{ $title }}{{ end }}{{ if $workTitle }} + {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} + {{ $workAuthorName }}, {{ end }}{{ $workTitle }} + {{ end }}{{ Safe $placeTag }} + {{- end -}} + {{- else -}} + {{ Safe $fortsPrefix }}{{ if $title }}{{ $title }}{{ end }}{{ if $workTitle }} + {{ if $title }}, {{ if $categoryFlags.Uebersetzung }}Übersetzung aus:{{ else }}Auszug aus:{{ end }} {{ end }}{{ if $workAuthorName }} + {{ $workAuthorName }}, {{ end }}{{ $workTitle }} + {{ else if not $title }} + Beitrag ohne Titel + {{ end }}{{ Safe $placeTag }} + {{- end -}} + {{- end -}} + + {{- end -}} +
+ +{{- if eq $displayMode "issue" -}} + {{- /* Only show annotations for issue view and non-continuation pieces */ -}} + {{- if not $isContinuation -}} + {{- range $annotation := $piece.AnnotationNote.Annotations -}} +
+ {{ Safe $annotation.HTML }} +
+ {{- end -}} + {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/views/routes/ort/components/_place_pieces.gohtml b/views/routes/ort/components/_place_pieces.gohtml index 9758474..33ed876 100644 --- a/views/routes/ort/components/_place_pieces.gohtml +++ b/views/routes/ort/components/_place_pieces.gohtml @@ -60,7 +60,7 @@
{{- /* Use first piece for display text with colon format for places */ -}} - {{ template "_piece_summary_for_place" (dict "Piece" (index $groupedItems 0) "CurrentActorID" "") }} + {{ template "_unified_piece_entry" (dict "Piece" (index $groupedItems 0) "CurrentActorID" "" "DisplayMode" "place" "ShowPlaceTags" false "UseColonFormat" true "ShowContinuation" false) }} {{- /* Show all citations from all pieces in this group inline with commas */ -}} {{ " " }}{{- range $groupIndex, $groupItem := $groupedItems -}} diff --git a/views/routes/piece/components/_piece_inhaltsverzeichnis.gohtml b/views/routes/piece/components/_piece_inhaltsverzeichnis.gohtml index d6fb34e..e20cb1a 100644 --- a/views/routes/piece/components/_piece_inhaltsverzeichnis.gohtml +++ b/views/routes/piece/components/_piece_inhaltsverzeichnis.gohtml @@ -19,7 +19,7 @@
- {{ template "_inhaltsverzeichnis_eintrag" $firstPiece.PieceByIssue }} + {{ template "_unified_piece_entry" (dict "Piece" $firstPiece.PieceByIssue "DisplayMode" "piece" "ShowPlaceTags" true "UseColonFormat" false "ShowContinuation" true) }}
{{ end }} @@ -88,7 +88,7 @@ {{ range $otherPiece := $pageEntry.OtherPieces }}
- {{ template "_inhaltsverzeichnis_eintrag" $otherPiece.PieceByIssue }} + {{ template "_unified_piece_entry" (dict "Piece" $otherPiece.PieceByIssue "DisplayMode" "piece" "ShowPlaceTags" true "UseColonFormat" false "ShowContinuation" true) }}
{{ end }} {{ else }}