use partials for data rows in organisation timelines
This commit is contained in:
parent
88b685cf2e
commit
1da4c591d2
7 changed files with 233 additions and 58 deletions
|
@ -25,11 +25,6 @@
|
|||
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' });
|
||||
|
@ -37,61 +32,33 @@
|
|||
dataTable.addColumn({ type: 'date', id: 'End' });
|
||||
|
||||
dataTable.addRows([
|
||||
{{ with ( .GetPage "cv/roles" ).Pages -}}
|
||||
{{- 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 -}}
|
||||
")
|
||||
],
|
||||
{{-
|
||||
printf `["%s", "%s", "%s", %s, %s],`
|
||||
(
|
||||
partialCached
|
||||
"cv/organisation/get_role_organisation_string.html"
|
||||
( dict "sc" $ "pc" . )
|
||||
.
|
||||
)
|
||||
(
|
||||
partialCached
|
||||
"cv/organisation/get_role_role_string.html"
|
||||
( dict "sc" $ "pc" . )
|
||||
.
|
||||
)
|
||||
(
|
||||
partialCached
|
||||
"cv/organisation/get_role_colour.html"
|
||||
( dict "end_date" .Params.end_date "is_paid" .Params.paid )
|
||||
.Params.end_date .Params.paid
|
||||
)
|
||||
( partialCached "cv/organisation/get_role_start_date.html" .Date .Date )
|
||||
( partialCached "cv/organisation/get_role_end_date.html" .Params.end_date .Params.end_date )
|
||||
| safeJS
|
||||
-}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue