mirror of
				https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
				synced 2025-10-31 09:55:30 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {{- /*
 | |
|     Piece Link Component
 | |
|     Creates appropriate links to pieces/beiträge based on their structure
 | |
| 
 | |
|     Usage: {{ template "_piece_link" (dict
 | |
|         "Piece" $piece
 | |
|         "DisplayMode" "search|akteure|place|kategorie|issue"
 | |
|         "ShowUnifiedEntry" true|false
 | |
|         "LongForm" true|false
 | |
|         "CurrentActorID" $currentActorID
 | |
|     ) }}
 | |
| 
 | |
|     Parameters:
 | |
|     - Piece: The piece object to create links for
 | |
|     - DisplayMode: Context for formatting ("search", "akteure", "place", "kategorie", "issue")
 | |
|     - ShowUnifiedEntry: Whether to show the unified piece description (default: true)
 | |
|     - LongForm: Whether to use long form for unified entry (default: false for search only)
 | |
|     - CurrentActorID: ID of current actor (for akteure view context, optional)
 | |
| 
 | |
|     Link Logic:
 | |
|     - Single-issue pieces: Link directly to the issue/page
 | |
|     - Multi-issue pieces: Link to /beitrag/{piece-id} endpoint
 | |
|     - Always wraps the unified piece entry in appropriate link(s)
 | |
| */ -}}
 | |
| 
 | |
| {{- $piece := .Piece -}}
 | |
| {{- $displayMode := .DisplayMode -}}
 | |
| {{- if not $displayMode -}}{{ $displayMode = "search" }}{{- end -}}
 | |
| {{- $showUnifiedEntry := .ShowUnifiedEntry -}}
 | |
| {{- if eq $showUnifiedEntry nil -}}{{ $showUnifiedEntry = true }}{{- end -}}
 | |
| {{- $longForm := .LongForm -}}
 | |
| {{- if eq $longForm nil -}}{{ $longForm = (eq $displayMode "search") }}{{- end -}}
 | |
| {{- $currentActorID := .CurrentActorID -}}
 | |
| 
 | |
| {{- /* Determine if this is a multi-issue piece */ -}}
 | |
| {{- $isMultiIssue := gt (len $piece.IssueRefs) 1 -}}
 | |
| 
 | |
| {{- /* Always show the unified entry without any link wrapper */ -}}
 | |
| {{- if $showUnifiedEntry -}}
 | |
|     {{ template "_unified_piece_entry" (dict
 | |
|         "Piece" $piece
 | |
|         "DisplayMode" $displayMode
 | |
|         "ShowPlaceTags" true
 | |
|         "UseColonFormat" (eq $displayMode "place")
 | |
|         "ShowContinuation" (eq $displayMode "issue")
 | |
|         "LongForm" $longForm
 | |
|         "CurrentActorID" $currentActorID
 | |
|     ) }}
 | |
| {{- end -}} | 
