feat: finish CV

This commit is contained in:
Ben Goldsworthy 2024-02-04 01:40:15 +00:00
parent 941c59b7a7
commit 187900fd5b
16 changed files with 1604 additions and 166 deletions

View file

@ -0,0 +1,9 @@
<!--
Renders the description of an organisation.
@params content Organisation description.
-->
<section id="description" class="organisation__description">
{{ .content }}
</section>

View file

@ -0,0 +1,38 @@
<!--
Return the number of a certain type of items an organisation has.
@params sc Site context.
@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 -}}
{{- $section_title := .section_title -}}
{{- $organisation_titles := .organisation_titles -}}
{{- $icon := dict
"Roles" "🔨"
"Blog Posts" "📌"
"Web Sites" "✉"
"Programs" "P"
"Writings" "🖉"
"Audiovisuals" "AV"
"Others" "?"
"Qualifications" "Q"
"Awards" "A"
"Appearances" "ME"
-}}
{{- $section_items := default
( where ( where $sc.Site.Pages "Section" "blog" ) "Parent.Title" $section_title )
( default
( where ( where $sc.Site.Pages "Section" "cv" ) "Parent.Title" $section_title )
( where ( where $sc.Site.Pages "Section" "portfolio" ) "Parent.Title" $section_title )
)
-}}
{{- $organisation_items := where $section_items ".Params.organisations" "intersect" $organisation_titles -}}
<span class="organisations-table__items-icon{{- if ( eq ( len $organisation_items ) 0 ) }} organisations-table__items-icon--none{{- end -}}">
{{- index $icon $section_title -}} <br>
{{- ( len $organisation_items ) -}}
</span>

View file

@ -0,0 +1,34 @@
<!--
Renders related items as an unordered list.
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
@params content Related items.
-->
{{- $section_title := .section_title -}}
{{- $content := .content -}}
<h2 class="subheading">{{ $section_title }} ({{ len $content }})</h2>
<ul class="related-items related-items--list">
{{- range $content -}}
{{- $is_expired := and ( isset .Params "end_date" ) ( lt .Params.end_date ( (time now).Format "2006-01-02" ) ) -}}
<li class="related-item{{- if $is_expired }} related-item--expired{{- end -}}">
<a href="{{- .RelPermalink -}}">
{{- .Title | safeHTML -}}
</a>
{{- with .Params.grade -}}
<span class="related-item__grade">
Grade: {{ . -}}
</span>
{{- end -}}
{{- with .Params.end_date -}}
<span class="related-item__expiry">
<abbr title="expire{{- if $is_expired -}}d{{- else -}}s{{- end -}}">Exp</abbr>: {{ dateFormat "Jan 2 2006" . -}}
</span>
{{- end -}}
</li>
{{- end -}}
</ul>

View file

@ -0,0 +1,36 @@
<!--
Renders related items as tiles.
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
@params organisation_title Title of the organisation.
@params content Related items.
-->
{{- $section_title := .section_title -}}
{{- $organisation_title := .organisation_title -}}
{{- $content := .content -}}
{{- if gt ( len $content ) 4 -}}
<details class="related-items related-items--tiles related-items--collapsible">
<summary>
{{- else -}}
<div id="{{ $section_title | anchorize }}" class="related-items related-items--tiles">
{{- end -}}
<h2 class="subheading related-items-title">{{ $section_title }} ({{ len $content }})</h2>
<div class="index">
{{ range first 4 $content }}
{{ partialCached "item-tile.html" . ( print $organisation_title "_" $section_title "_" .Title ) }}
{{ end }}
</div>
{{- if gt ( len $content ) 4 -}}
</summary>
<div class="index">
{{ range after 4 $content }}
{{ partial "item-tile.html" . }}
{{ end }}
</div>
</details>
{{ else }}
</div>
{{ end }}

View file

@ -0,0 +1,30 @@
<!--
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 -}}

View file

@ -0,0 +1,26 @@
<!--
Renders the related items for a given organisation.
@params sc Site context
@params organisation_titles `dict` of organsation titles for this org and all of its children.
-->
{{- $sc := .sc -}}
{{- $organisation_titles := .organisation_titles -}}
<section id="related" class="organisation__related">
<!-- Blog posts -->
{{- partial "cv/organisation/related-items-section.html.tmpl" ( dict "sc" $sc "tls" "blog" "section_title" "Blog Posts" "organisation_titles" $organisation_titles ) -}}
<!-- Portfolios -->
{{- range ( ( $sc.GetPage "portfolio" ).Sections ).ByWeight -}}
{{- partial "cv/organisation/related-items-section.html.tmpl" ( dict "sc" $sc "tls" "portfolio" "section_title" .Title "organisation_titles" $organisation_titles ) -}}
{{- end -}}
<!-- Qualifications, Awards and Appearances -->
{{- range ( where ( ( $sc.GetPage "cv" ).Sections ) "Title" "not in" ( slice "Organisations" "Roles" ) ).ByWeight }}
{{- partial "cv/organisation/related-items-section.html.tmpl" ( dict "sc" $sc "tls" "cv" "section_title" .Title "organisation_titles" $organisation_titles ) -}}
{{- end -}}
</section>

View file

@ -0,0 +1,7 @@
<!--
Renders a role timeline for an organisation.
-->
<section id="roles-timeline" class="organisation__timeline">
<div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
</section>