feat: finish CV
This commit is contained in:
parent
941c59b7a7
commit
187900fd5b
16 changed files with 1604 additions and 166 deletions
File diff suppressed because it is too large
Load diff
|
@ -2,13 +2,13 @@
|
|||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = where $pctx.RegularPages "Params.redact" "ne" true -}}
|
||||
{{- $pages = where $pctx.RegularPages "Params.redact" "ne" true -}}
|
||||
{{- else -}}
|
||||
{{- $pages = where $pctx.Pages "Params.redact" "ne" true -}}
|
||||
{{- $pages = where $pctx.Pages "Params.redact" "ne" true -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
|
|
|
@ -19,31 +19,26 @@
|
|||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
{{ range $.Site.Data.locations }}
|
||||
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
|
||||
{{ end }}
|
||||
|
||||
{{ .Scratch.Set "maxItems" 0 }}
|
||||
{{ .Scratch.Set "numOfItems" 0 }}
|
||||
|
||||
{{ range $key, $value := $.Site.Data.locations }}
|
||||
{{ $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) }}
|
||||
{{ $.Scratch.Set "numOfItems" ( len $childPosts ) }}
|
||||
{{ if ( gt ( $.Scratch.Get "numOfItems" ) ( $.Scratch.Get "maxItems" ) ) }}
|
||||
{{ $.Scratch.Set "maxItems" ( $.Scratch.Get "numOfItems" ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- range $.Site.Data.locations -}}
|
||||
/* L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); */
|
||||
{{- end -}}
|
||||
|
||||
L.heatLayer(
|
||||
[
|
||||
{{- range $key, $value := $.Site.Data.locations -}}
|
||||
{{- $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) -}}
|
||||
[ {{ .lat }}, {{ .lon }}, {{ len $childPosts }} ],
|
||||
{{- range .Site.AllPages -}}
|
||||
{{- with .Params.locations -}}
|
||||
{{- range . -}}
|
||||
{{- with ( index $.Site.Data.locations . ) -}}
|
||||
[ {{ .lat }}, {{ .lon }} ],
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
],
|
||||
{
|
||||
max: {{ $.Scratch.Get "maxItems" }},
|
||||
gradient: { 0.4: 'blue', 0.65: 'lime', 1: 'red' }
|
||||
minOpacity: 0.5,
|
||||
gradient: {0.2: 'blue', 0.5: 'lime', 1: 'red'}
|
||||
|
||||
}
|
||||
).addTo(map);
|
||||
</script>
|
||||
|
@ -51,13 +46,19 @@
|
|||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
<h1 class="page-title">{{ .Title | safeHTML }}.</h1>
|
||||
{{ .Content }}
|
||||
<h1 class="page-title">{{ .Title | safeHTML }}.</h1>
|
||||
{{ .Content }}
|
||||
</header>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
<article class="site-content__body site-content__body--chart">
|
||||
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
|
||||
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
|
||||
|
||||
<ul style="grid-area: section-content">
|
||||
{{- range $key, $value := $.Site.Data.locations -}}
|
||||
<li itemscope itemtype="https://schema.org/Place">{{ $key }}</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
{{ define "main-body" }}
|
||||
{{ with .GetPage "cv/organisations" }}
|
||||
{{ partial "cv/organisations/items-table.html" . }}
|
||||
{{ partial "cv/organisations/organisations-table.html.tmpl" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
|
@ -13,104 +13,106 @@
|
|||
{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
||||
{{ $titles := .Scratch.Get "titles" }}
|
||||
<script>
|
||||
google.charts.load('current', {'packages':['timeline']});
|
||||
google.charts.setOnLoadCallback(drawChart);
|
||||
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
||||
{{ $titles := .Scratch.Get "titles" }}
|
||||
<script>
|
||||
google.charts.load('current', {'packages':['timeline']});
|
||||
google.charts.setOnLoadCallback(drawChart);
|
||||
|
||||
function drawChart() {
|
||||
var container = document.getElementById('timeline');
|
||||
var chart = new google.visualization.Timeline(container);
|
||||
var dataTable = new google.visualization.DataTable();
|
||||
function drawChart() {
|
||||
var container = document.getElementById('timeline');
|
||||
var chart = new google.visualization.Timeline(container);
|
||||
var dataTable = new google.visualization.DataTable();
|
||||
|
||||
dataTable.addColumn({ type: 'string', id: 'Type' });
|
||||
dataTable.addColumn({ type: 'string', id: 'Job Title' });
|
||||
dataTable.addColumn({ type: 'string', id: 'style', role: 'style' });
|
||||
dataTable.addColumn({ type: 'date', id: 'Start' });
|
||||
dataTable.addColumn({ type: 'date', id: 'End' });
|
||||
dataTable.addRows([
|
||||
{{- $unpaid_past := "#FFFFF0" -}}
|
||||
{{- $paid_past := "#FCFCA6" -}}
|
||||
{{- $unpaid_current := "#BBBBB0" -}}
|
||||
{{- $paid_current := "#BCBC7E" -}}
|
||||
{{ with ( .GetPage "cv/roles" ).Pages -}}
|
||||
{{- range ( where . ".Params.organisations" "intersect" $titles ) -}}
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
[
|
||||
"
|
||||
{{- with .Params.organisations -}}
|
||||
{{- $.Scratch.Set "parents" ( slice ) -}}
|
||||
{{- range . -}}
|
||||
{{- range ( where ( where $.Site.Pages "Type" "cv" ) "Title" . ) -}}
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append "███████████████" ) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append ( .Title | plainify ) ) -}}
|
||||
{{- $unpaid_past := "#FFFFF0" -}}
|
||||
{{- $paid_past := "#FCFCA6" -}}
|
||||
{{- $unpaid_current := "#BBBBB0" -}}
|
||||
{{- $paid_current := "#BCBC7E" -}}
|
||||
|
||||
dataTable.addColumn({ type: 'string', id: 'Type' });
|
||||
dataTable.addColumn({ type: 'string', id: 'Job Title' });
|
||||
dataTable.addColumn({ type: 'string', id: 'style', role: 'style' });
|
||||
dataTable.addColumn({ type: 'date', id: 'Start' });
|
||||
dataTable.addColumn({ type: 'date', id: 'End' });
|
||||
|
||||
dataTable.addRows([
|
||||
{{ with ( .GetPage "cv/roles" ).Pages -}}
|
||||
{{- range ( where . ".Params.organisations" "intersect" $titles ) -}}
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
[
|
||||
"
|
||||
{{- with .Params.organisations -}}
|
||||
{{- $.Scratch.Set "parents" ( slice ) -}}
|
||||
{{- range . -}}
|
||||
{{- range ( where ( where $.Site.Pages "Type" "cv" ) "Title" . ) -}}
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append "███████████████" ) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" . $.File.Path }}
|
||||
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append ( .Title | plainify ) ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- delimit ( $.Scratch.Get "parents" ) ", " -}}
|
||||
{{- $.Scratch.Delete "parents" -}}
|
||||
{{- end -}}
|
||||
",
|
||||
"
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
███████████████
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Title | plainify -}}
|
||||
{{- end -}}
|
||||
",
|
||||
"{{ if .Params.end_date -}}
|
||||
{{- if .Params.paid -}}
|
||||
{{- $paid_past -}}
|
||||
{{- else -}}
|
||||
{{- $unpaid_past -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.paid -}}
|
||||
{{- $paid_current -}}
|
||||
{{- else -}}
|
||||
{{- $unpaid_current -}}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" . $.File.Path }}
|
||||
{{- end -}}
|
||||
{{- end }}",
|
||||
new Date("{{ .Date.Format "2006-01-02" }}"),
|
||||
new Date("
|
||||
{{- if .Params.end_date -}}
|
||||
{{- .Params.end_date -}}
|
||||
{{- else -}}
|
||||
{{- now.Format "2006-01-02" -}}
|
||||
{{- end -}}
|
||||
")
|
||||
],
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
]);
|
||||
{{- end -}}
|
||||
{{- delimit ( $.Scratch.Get "parents" ) ", " -}}
|
||||
{{- $.Scratch.Delete "parents" -}}
|
||||
{{- end -}}
|
||||
",
|
||||
"
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
███████████████
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Title | plainify -}}
|
||||
{{- end -}}
|
||||
",
|
||||
"{{ if .Params.end_date -}}
|
||||
{{- if .Params.paid -}}
|
||||
{{- $paid_past -}}
|
||||
{{- else -}}
|
||||
{{- $unpaid_past -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.paid -}}
|
||||
{{- $paid_current -}}
|
||||
{{- else -}}
|
||||
{{- $unpaid_current -}}
|
||||
{{- end -}}
|
||||
{{- end }}",
|
||||
new Date("{{ .Date.Format "2006-01-02" }}"),
|
||||
new Date("
|
||||
{{- if .Params.end_date -}}
|
||||
{{- .Params.end_date -}}
|
||||
{{- else -}}
|
||||
{{- now.Format "2006-01-02" -}}
|
||||
{{- end -}}
|
||||
")
|
||||
],
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
]);
|
||||
|
||||
var options = {
|
||||
title: '{{ .Title | plainify }} Roles Timeline',
|
||||
height: '100%',
|
||||
chartArea: {
|
||||
width: '94%'
|
||||
},
|
||||
width: '100%',
|
||||
timeline: { showBarLabels: true }
|
||||
};
|
||||
var options = {
|
||||
title: '{{ .Title | plainify }} Roles Timeline',
|
||||
height: '100%',
|
||||
chartArea: {
|
||||
width: '94%'
|
||||
},
|
||||
width: '100%',
|
||||
timeline: { showBarLabels: true }
|
||||
};
|
||||
|
||||
chart.draw(dataTable, options);
|
||||
}
|
||||
</script>
|
||||
{{ else }}
|
||||
{{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }}
|
||||
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
chart.draw(dataTable, options);
|
||||
}
|
||||
</script>
|
||||
{{- else -}}
|
||||
{{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }}
|
||||
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-header" }}
|
||||
|
@ -168,54 +170,16 @@
|
|||
{{ end }}
|
||||
{{ .Scratch.Set "titles" $titles }}
|
||||
|
||||
<main id="organisation-body" class="site-content__body">
|
||||
<section id="description">
|
||||
{{ .Content }}
|
||||
</section>
|
||||
<main class="site-content__body organisation">
|
||||
|
||||
<section id="roles-timeline">
|
||||
<div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
|
||||
</section>
|
||||
{{- partial "cv/organisation/description.html.tmpl" ( dict "content" .Content ) -}}
|
||||
|
||||
<section id="related" class="row">
|
||||
{{- $titles := .Scratch.Get "titles" -}}
|
||||
{{- partial "cv/organisation/roles-timeline.html.tmpl" -}}
|
||||
|
||||
{{ range ( where ( ( .GetPage "blog" ).Sections ) "Title" "Blog Posts" ) }}
|
||||
{{ $section_title := .Title }}
|
||||
{{ with where ( where ( where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
|
||||
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- partial "cv/organisation/related-items.html.tmpl" ( dict "sc" $ "organisation_titles" ( .Scratch.Get "titles" ) "organisation_title" .Title ) -}}
|
||||
|
||||
{{ range ( where ( ( .GetPage "portfolio" ).Sections ) "Title" "!=" "Appearances" ).ByTitle }}
|
||||
{{ $section_title := .Title }}
|
||||
{{ with where ( where ( where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
|
||||
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range ( where ( ( .GetPage "cv" ).Sections ) "Title" "Qualifications" ) }}
|
||||
{{ $section_title := .Title }}
|
||||
{{ with where ( where ( where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
|
||||
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range ( where ( (.GetPage "cv").Sections ) "Title" "Awards" ) }}
|
||||
{{ $section_title := .Title }}
|
||||
{{ with where ( where ( where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
|
||||
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range ( where ( (.GetPage "portfolio").Sections ) "Title" "Appearances" ).ByTitle }}
|
||||
{{ $section_title := .Title }}
|
||||
{{ with where ( where ( where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
|
||||
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
</main>
|
||||
|
||||
{{ else if eq .Type "cv" }}
|
||||
<article class="site-content__body site-content__body--chart">
|
||||
<div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
|
||||
|
|
9
layouts/partials/cv/organisation/description.html.tmpl
Normal file
9
layouts/partials/cv/organisation/description.html.tmpl
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!--
|
||||
Renders the description of an organisation.
|
||||
|
||||
@params content Organisation description.
|
||||
-->
|
||||
|
||||
<section id="description" class="organisation__description">
|
||||
{{ .content }}
|
||||
</section>
|
38
layouts/partials/cv/organisation/get-num-of-items.html.tmpl
Normal file
38
layouts/partials/cv/organisation/get-num-of-items.html.tmpl
Normal 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>
|
|
@ -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>
|
|
@ -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 }}
|
|
@ -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 -}}
|
26
layouts/partials/cv/organisation/related-items.html.tmpl
Normal file
26
layouts/partials/cv/organisation/related-items.html.tmpl
Normal 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>
|
|
@ -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>
|
|
@ -0,0 +1,81 @@
|
|||
<section class="site-content__body">
|
||||
<table class="organisations-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Organisation</th>
|
||||
<th>Children</th>
|
||||
<th>Related Items</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{- range .Pages -}}
|
||||
{{- $organisation_title := .Title -}}
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
{{ $organisation_titles := slice ( $organisation_title | plainify ) }}
|
||||
{{ with .Sections }}
|
||||
{{ $organisation_titles = $organisation_titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
|
||||
{{ end }}
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.featured_image -}}
|
||||
<img class="organisation-table__logo" loading="lazy" src="
|
||||
{{- if .Resources.GetMatch .Params.featured_image -}}
|
||||
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- .Params.featured_image -}}
|
||||
{{- end -}}
|
||||
">
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}}
|
||||
{{- with .Params.markup_title -}}{{- . | safeHTML -}}{{- else -}}{{- $organisation_title | safeHTML -}}{{- end -}}
|
||||
{{- if .Params.TitleLang -}}</i>{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="organisations-table__items-icon{{- if ( eq ( len .Sections ) 0 ) }} organisations-table__items-icon--none{{- end -}}">
|
||||
🧑🧒 <br>
|
||||
{{- len .Sections -}}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{- range slice
|
||||
"Roles"
|
||||
"Blog Posts"
|
||||
"Web Sites"
|
||||
"Programs"
|
||||
"Writings"
|
||||
"Audiovisuals"
|
||||
"Others"
|
||||
"Qualifications"
|
||||
"Awards"
|
||||
"Appearances"
|
||||
-}}
|
||||
{{- partialCached "cv/organisation/get-num-of-items.html.tmpl" ( dict "sc" $ "section_title" . "organisation_titles" $organisation_titles ) ( print $organisation_title "_" . ) -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
|
@ -1,10 +1,10 @@
|
|||
<section class="site-content__body">
|
||||
{{ range ( ( where .Pages "Draft" false ).GroupByPublishDate "2006" ) }}
|
||||
{{ if ( not ( eq .Key "0001" ) ) }}
|
||||
{{ partial "header-tile.html" . }}
|
||||
{{ partialCached "header-tile.html" . .Key }}
|
||||
{{ range .Pages }}
|
||||
{{ if ( not ( .IsDescendant ( .GetPage "/cv/roles" ) ) ) }}
|
||||
{{ partial "item-tile.html" . }}
|
||||
{{ partialCached "item-tile.html" . .Title }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
{{ $all_organisations := partialCached "get_all_organisations.html" . }}
|
||||
<!-- TODO: Replace with hierarchy partial -->
|
||||
{{- range ( .GetTerms "organisations" ) -}}
|
||||
{{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }}
|
||||
{{ with ( union ( union ( where $all_organisations "Title" ( .Title | plainify ) ) ( where $all_organisations "Params.abbreviation" ( .Title | plainify ) ) ) ( where $all_organisations "Params.fka" ( .Title | plainify ) ) ) }}
|
||||
{{ range . }}
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
|
|
11
layouts/partials/utils/get_content_by_section.html
Normal file
11
layouts/partials/utils/get_content_by_section.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
Given a top-level section title slug [blog|cv|portfolio], returns all
|
||||
`Pages` within that top-level section.
|
||||
|
||||
@param sc The site content (`$`)
|
||||
@param section_slug The slug of the section to use [blog|cv|portfolio]
|
||||
|
||||
@returns Pages|nil
|
||||
-->
|
||||
|
||||
{{- where ( ( .sc.GetPage "cv" ).Sections ) "Title" .section_title -}}
|
Loading…
Reference in a new issue