update theme

This commit is contained in:
Ben Goldsworthy 2023-10-03 13:08:35 +01:00
parent 43ddb22f80
commit a35946ae92
19 changed files with 1418 additions and 223 deletions

View file

@ -8,8 +8,7 @@
{{ define "header-scripts" }}
{{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }}
{{ $googleChartsJS := resources.Get "js/google-charts.js" | fingerprint }}
<script id="Google-Charts-script" src="{{ $googleChartsJS.Permalink }}" integrity="{{ $googleChartsJS.Data.Integrity }}"></script>
<script id="Google-Charts-script" src="/js/google-charts.js"></script>
{{ end }}
{{ end }}
@ -24,22 +23,22 @@
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([
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 ) -}}
[
"{{- delimit ( intersect .Params.organisations $titles ) ", " | safeHTML -}}",
"{{- .Title | safeHTML -}}",
[
"{{- delimit ( intersect .Params.organisations $titles ) ", " | safeHTML -}}",
"{{- .Title | plainify -}}",
"{{ if .Params.end_date -}}
{{- if .Params.paid -}}
{{- $paid_past -}}
@ -53,19 +52,19 @@
{{- $unpaid_current -}}
{{- end -}}
{{- end }}",
new Date("{{ .Date.Format "2006-01-02" }}"),
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 -}}
]);
var options = {
title: '{{ .Title | plainify }} Roles Timeline',
height: '100%',
@ -75,61 +74,56 @@
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" ) }}
<script src="{{ $js.RelPermalink }}"></script>
{{ $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" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header">
<div class="article-header__featured-image"
{{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}">
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2>
</div>
</div>
</header>
<header class="site-content__header">
<div class="article-header__featured-image"
{{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}">
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2>
</div>
</div>
</header>
{{ else }}
<header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}.</h2>
{{ .Content }}
{{ if eq .Type "cv" }}
<nav class="page-header__minor-links">
<ul>
{{ range ( where .Sections "Type" "not in" ( slice "cv/roles" ) ).ByTitle }}
<li><a href="{{ .RelPermalink }}"><h3>{{ .Title }}</h3></a> <p>({{ len (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) }})</p></li>
{{ end }}
</ul>
</nav>
{{ end }}
{{ if eq .Type "cv" }}
<aside class="timeline__legend">
<div>
<label for="legend__past">Past</label>
<div id="legend__past">
<span><div class="colour-square colour-square--unpaid-past"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-past"></div> <p>Paid</p></span>
</div>
</div>
<div>
<label for="legend__current">Current</label>
<div id="legend__current">
<span><div class="colour-square colour-square--unpaid-current"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-current"></div> <p>Paid</p></span>
</div>
</div>
</aside>
{{ end }}
<h2 class="page-title">{{ .Title | safeHTML }}. {{ if not ( or ( eq .Type "cv" ) ( eq .Type "cv/organisations" ) ) -}}
{{- range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
</a>
{{- end -}}
{{- end -}}
</h2>
{{- .Content -}}
{{- if ( and ( eq .Type "cv" ) ( not ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) ) -}}
<nav class="page-header__minor-links">
<ul>
{{ range ( where .Sections "Type" "not in" ( slice "cv/roles" ) ).ByTitle }}
<li><a href="{{ .RelPermalink }}"><h3>{{ .Title }}</h3></a> <p>({{ len (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) }})</p></li>
{{ end }}
</ul>
</nav>
{{- partialCached "cv/timeline-legend.html" . -}}
{{- else -}}
<nav class="page-header__minor-links">
{{- partial "years-list.html" . -}}
</nav>
{{- end -}}
</header>
{{ end }}
{{ end }}
@ -141,63 +135,47 @@
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
{{ end }}
{{ .Scratch.Set "titles" $titles }}
<main id="organisation-body" class="site-content__body">
<section id="description">
{{ .Content }}
</section>
<section id="roles-timeline">
<aside class="timeline__legend">
<div>
<label for="legend__past">Past</label>
<div id="legend__past">
<span><div class="colour-square colour-square--unpaid-past"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-past"></div> <p>Paid</p></span>
</div>
</div>
<div>
<label for="legend__current">Current</label>
<div id="legend__current">
<span><div class="colour-square colour-square--unpaid-current"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-current"></div> <p>Paid</p></span>
</div>
</div>
</aside>
<div id="timeline" aria-label="Role Time" role="img">Javascript must be enabled to view this chart.</div>
<div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
</section>
<section id="related" class="row">
{{- $titles := .Scratch.Get "titles" -}}
{{ range (where ((.GetPage "blog").Sections) "Title" "Blog Posts") }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ 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 .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ 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 .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ 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 .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ 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 .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
@ -206,19 +184,13 @@
{{ 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>
</article>
{{ else if eq .Type "cv/organisations" . }}
{{ with .GetPage "cv/organisations" }}
{{ partial "cv/organisations/items-table.html" . }}
{{ end }}
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ end }}
{{ 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>
</article>
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ end }}
{{ define "main-footer" }}
@ -227,9 +199,9 @@
<section id="hierarchy">
<h3 class="subheading">Hierarchy</h3>
{{ $.Scratch.Set "parents" ( slice ) }}
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $ ) }}
{{ partial "cv/organisations/recursive-parents.html" ( dict "c" . "g" $ ) }}
{{- $parents := partial "cv/organisations/reverse-slice.html" ( $.Scratch.Get "parents" ) -}}
{{- range $parents -}}<ul><li class="hierarchy-item hierarchy-item--parent"><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a>{{- end -}}
<ul><li class="hierarchy-item hierarchy-item--current">{{ .Title | safeHTML }}</li>
{{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }}