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

@ -6,111 +6,113 @@
{{- if .IsDescendant ( .GetPage "/cv/organisations" ) -}}--single{{- else -}}--section{{- end }} layouts-cv-section
{{ end }}
{{ define "header-scripts" }}
{{ define "header-scripts" }}
{{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }}
<script id="Google-Charts-script" src="/js/google-charts.js"></script>
{{ end }}
{{ 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>