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
50
layouts/partials/cv/organisation/get_role_colour.html
Normal file
50
layouts/partials/cv/organisation/get_role_colour.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
Renders a role's class (i.e. colour based on paid/unpaid).
|
||||
|
||||
@params end_date The end date of the role, or undefined if the role is ongoing.
|
||||
@params is_paid Whether the role is paid or not.
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "end_date" ) ) -}}
|
||||
{{- errorf "No end date passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "is_paid" ) ) -}}
|
||||
{{- errorf "No 'is_paid' passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $end_date := .end_date -}}
|
||||
{{- $is_paid := .is_paid -}}
|
||||
|
||||
|
||||
<!-- Variable Initialisation -->
|
||||
|
||||
{{- $unpaid_past := "#FFFFF0" -}}
|
||||
{{- $paid_past := "#FCFCA6" -}}
|
||||
{{- $unpaid_current := "#BBBBB0" -}}
|
||||
{{- $paid_current := "#BCBC7E" -}}
|
||||
{{- $colour := "" -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if $end_date -}}
|
||||
{{- if $is_paid -}}
|
||||
{{- $colour = $paid_past -}}
|
||||
{{- else -}}
|
||||
{{- $colour = $unpaid_past -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if $is_paid -}}
|
||||
{{- $colour = $paid_current -}}
|
||||
{{- else -}}
|
||||
{{- $colour = $unpaid_current -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- return $colour -}}
|
Loading…
Add table
Add a link
Reference in a new issue