mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-30 01:25:30 +00:00
finish person view
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
{{ $workPieces := LookupPieces $w.Item }}
|
||||
{{ if len $workPieces }}
|
||||
<div class="mt-1 text-lg">
|
||||
{{- /* Group pieces by category and display inline */ -}}
|
||||
{{- $groupedByCategory := dict -}}
|
||||
{{- /* Group pieces by piece ID first to combine all categories per piece, then by additional authors */ -}}
|
||||
{{- $pieceData := dict -}}
|
||||
{{- range $_, $p := $workPieces -}}
|
||||
{{- $categoryFlags := GetCategoryFlags $p.Item -}}
|
||||
{{- $categories := slice -}}
|
||||
@@ -138,16 +138,22 @@
|
||||
{{- end -}}
|
||||
{{- $sortedAdditionalAuthorIDs := sortStrings $pieceAdditionalAuthorIDs -}}
|
||||
|
||||
{{- /* Create grouping key with category + additional authors */ -}}
|
||||
{{- $sortedCategories := sortStrings $categories -}}
|
||||
{{- /* Store piece data by ID to combine categories and avoid duplicates */ -}}
|
||||
{{- $pieceData = merge $pieceData (dict $p.Item.ID (dict "piece" $p "categories" $categories "additionalAuthorIDs" $sortedAdditionalAuthorIDs)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Now group by combined categories and additional authors */ -}}
|
||||
{{- $groupedByCategory := dict -}}
|
||||
{{- range $pieceID, $data := $pieceData -}}
|
||||
{{- $sortedCategories := sortStrings $data.categories -}}
|
||||
{{- $categoryName := joinWithUnd $sortedCategories -}}
|
||||
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $sortedAdditionalAuthorIDs) -}}
|
||||
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $data.additionalAuthorIDs) -}}
|
||||
|
||||
{{- $existing := index $groupedByCategory $groupKey -}}
|
||||
{{- if $existing -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (append $existing $p)) -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (append $existing $data.piece)) -}}
|
||||
{{- else -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (slice $p)) -}}
|
||||
{{- $groupedByCategory = merge $groupedByCategory (dict $groupKey (slice $data.piece)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -213,8 +219,8 @@
|
||||
|
||||
{{- /* Process standalone work pieces that aren't linked to specific works */ -}}
|
||||
{{- if ne (len $workPieces) 0 -}}
|
||||
{{- /* Group standalone work pieces by category and additional authors */ -}}
|
||||
{{- $standaloneGrouped := dict -}}
|
||||
{{- /* Group standalone work pieces by piece ID first to combine categories, then by additional authors */ -}}
|
||||
{{- $standalonePieceData := dict -}}
|
||||
{{- range $_, $p := $workPieces -}}
|
||||
{{- /* Skip pieces that are already covered by works above */ -}}
|
||||
{{- $isPieceInWorks := false -}}
|
||||
@@ -266,21 +272,27 @@
|
||||
{{- end -}}
|
||||
{{- $sortedAdditionalAuthorIDs := sortStrings $pieceAdditionalAuthorIDs -}}
|
||||
|
||||
{{- /* Create grouping key with category + additional authors */ -}}
|
||||
{{- $sortedCategories := sortStrings $categories -}}
|
||||
{{- $categoryName := joinWithUnd $sortedCategories -}}
|
||||
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $sortedAdditionalAuthorIDs) -}}
|
||||
|
||||
{{- $existing := index $standaloneGrouped $groupKey -}}
|
||||
{{- if $existing -}}
|
||||
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (append $existing $p)) -}}
|
||||
{{- else -}}
|
||||
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (slice $p)) -}}
|
||||
{{- end -}}
|
||||
{{- /* Store piece data by ID to combine categories and avoid duplicates */ -}}
|
||||
{{- $standalonePieceData = merge $standalonePieceData (dict $p.Item.ID (dict "piece" $p "categories" $categories "additionalAuthorIDs" $sortedAdditionalAuthorIDs)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Now group by combined categories and additional authors */ -}}
|
||||
{{- $standaloneGrouped := dict -}}
|
||||
{{- range $pieceID, $data := $standalonePieceData -}}
|
||||
{{- $sortedCategories := sortStrings $data.categories -}}
|
||||
{{- $categoryName := joinWithUnd $sortedCategories -}}
|
||||
{{- $groupKey := printf "%s|%s" $categoryName (joinWithUnd $data.additionalAuthorIDs) -}}
|
||||
|
||||
{{- $existing := index $standaloneGrouped $groupKey -}}
|
||||
{{- if $existing -}}
|
||||
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (append $existing $data.piece)) -}}
|
||||
{{- else -}}
|
||||
{{- $standaloneGrouped = merge $standaloneGrouped (dict $groupKey (slice $data.piece)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Display standalone work pieces */ -}}
|
||||
{{- range $groupKey, $categoryPieces := $standaloneGrouped -}}
|
||||
<div class="mb-1.5 break-inside-avoid max-w-[95ch]">
|
||||
|
||||
Reference in New Issue
Block a user