fix CV templates
This commit is contained in:
parent
008920d191
commit
607686468d
2 changed files with 141 additions and 100 deletions
|
@ -3,7 +3,115 @@
|
||||||
{{ .Site.Title }}
|
{{ .Site.Title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-class" }}--section layouts-cv-organisations-section{{ end }}
|
{{ define "main-class" }}
|
||||||
|
{{- if .IsDescendant ( .GetPage "/cv/organisations" ) -}}
|
||||||
|
--single
|
||||||
|
{{- else -}}
|
||||||
|
--section
|
||||||
|
{{- end }} layouts-cv-organisations-section
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{ define "header-scripts" }}
|
||||||
|
<script id="Google-Charts-script" src="/js/google-charts/google-charts.js"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "footer-scripts" }}
|
||||||
|
{{ $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();
|
||||||
|
|
||||||
|
{{- $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 -}}
|
||||||
|
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append ( .Title | plainify ) ) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" . $.File.Path }}
|
||||||
|
{{- 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 }
|
||||||
|
};
|
||||||
|
|
||||||
|
chart.draw(dataTable, options);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-header" }}
|
{{ define "main-header" }}
|
||||||
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
||||||
|
@ -32,11 +140,40 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-body" }}
|
{{ define "main-body" }}
|
||||||
{{ with .GetPage "cv/organisations" }}
|
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
||||||
{{ partial "cv/organisations/organisations-table.html" . }}
|
{{ $titles := slice ( .Title | plainify ) }}
|
||||||
|
{{ with .Sections }}
|
||||||
|
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
|
||||||
|
{{ end }}
|
||||||
|
{{ .Scratch.Set "titles" $titles }}
|
||||||
|
|
||||||
|
<main class="site-content__body organisation">
|
||||||
|
{{- partial "cv/organisation/description.html" ( dict "content" .Content ) -}}
|
||||||
|
|
||||||
|
{{- partial "cv/organisation/roles-timeline.html" -}}
|
||||||
|
|
||||||
|
{{- partial "cv/organisation/related-items.html" ( dict "sc" $ "organisation_titles" ( .Scratch.Get "titles" ) "organisation_title" .Title ) -}}
|
||||||
|
</main>
|
||||||
|
{{ else }}
|
||||||
|
{{ partialCached "cv/organisations/organisations-table.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-footer" }}
|
{{ define "main-footer" }}
|
||||||
|
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
||||||
|
<footer class="site-content__footer">
|
||||||
|
<section id="hierarchy">
|
||||||
|
<h3 class="subheading">Hierarchy</h3>
|
||||||
|
{{ $.Scratch.Set "parents" ( slice ) }}
|
||||||
|
{{ 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 }}">{{ default .Title .Params.markup_title | .Page.RenderString }}</a>{{- end -}}
|
||||||
|
<ul><li class="hierarchy-item hierarchy-item--current">{{ default .Title .Params.markup_title | .Page.RenderString }}</li>
|
||||||
|
{{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{- range $parents -}}</li></ul>{{- end -}}
|
||||||
|
</section>
|
||||||
|
</footer>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -13,103 +13,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "footer-scripts" }}
|
{{ define "footer-scripts" }}
|
||||||
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
|
{{ if ( not ( .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();
|
|
||||||
|
|
||||||
{{- $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 -}}
|
|
||||||
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append ( .Title | plainify ) ) -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" . $.File.Path }}
|
|
||||||
{{- 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 }
|
|
||||||
};
|
|
||||||
|
|
||||||
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 }}
|
{{ $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>
|
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue