Omphaloskepsis-2/layouts/partials/cv/organisation/related-items-section.html....

31 lines
1.5 KiB
Cheetah

<!--
Renders the related items for a given organisation for a given section.
@params sc Site context
@params tls Slug of the top-level section of the sub-section.
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
@params organisation_titles `dict` of organsation titles for this org and all of its children.
-->
{{- $sc := .sc -}}
{{- $tls := .tls -}}
{{- $section_title := .section_title -}}
{{- $organisation_titles := .organisation_titles -}}
{{- range ( where ( ( $sc.GetPage $.tls ).Sections ) "Title" $.section_title ) -}}
{{- $section_items := where ( where $sc.Site.Pages "Section" $tls ) "Parent.Title" .Title -}}
{{- $organisation_items := where $section_items ".Params.organisations" "intersect" $organisation_titles -}}
{{- with ( where $organisation_items ".Params.redact" "ne" true ) -}}
{{- if in ( slice "Qualifications" "Awards" ) $section_title -}}
<section id="related-{{ $section_title | anchorize }}" class="related-section related-section--list">
{{- partial "cv/organisation/organisation-items-list.html.tmpl" ( dict "organisation_title" $sc.Title "section_title" $section_title "content" . ) -}}
</section>
{{- else -}}
<section id="related-{{ $section_title | anchorize }}" class="related-section related-section--tiles">
{{- partial "cv/organisation/organisation-items-tiles.html.tmpl" ( dict "section_title" $section_title "content" . ) -}}
</section>
{{- end -}}
{{- end -}}
{{- end -}}