From 89e8dd206867b6cb7e476f73aa15b8948c8bf146 Mon Sep 17 00:00:00 2001 From: Pau Trepat Segura Date: Sun, 5 Jul 2020 03:27:48 +0200 Subject: [PATCH] Add partials for multiple positions on one company --- .../partials/experiences/experience-info.html | 19 ++++----------- .../experiences/multiple-positions.html | 23 +++++++++++++++++++ .../partials/experiences/one-position.html | 17 ++++++++++++++ 3 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 layouts/partials/experiences/multiple-positions.html create mode 100644 layouts/partials/experiences/one-position.html diff --git a/layouts/partials/experiences/experience-info.html b/layouts/partials/experiences/experience-info.html index b2d1ea8..d8892de 100644 --- a/layouts/partials/experiences/experience-info.html +++ b/layouts/partials/experiences/experience-info.html @@ -1,14 +1,5 @@ -
-
-
{{ .company.name }}
-
{{ .designation }}
-

{{ .start }} - {{ if .end }} {{ .end }} {{ else }}Present{{ end }}, {{ .company.location }}

-
-

{{ .company.overview | markdownify }}

-
Responsibilities:
- -
+{{ if .positions }} + {{ partial "experiences/multiple-positions" . }} +{{ else }} + {{ partial "experiences/one-position.html" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/experiences/multiple-positions.html b/layouts/partials/experiences/multiple-positions.html new file mode 100644 index 0000000..6ed607c --- /dev/null +++ b/layouts/partials/experiences/multiple-positions.html @@ -0,0 +1,23 @@ +
+
+
{{ if .company.url }} {{end }} {{ .company.name }}
+ {{ $oldestPosition := index (last 1 .positions) 0}} + {{ $mostRecentPosition := index (first 1 .positions) 0}} +
{{ .designation }}
+

{{ $oldestPosition.start }} - {{ if $mostRecentPosition.end }} {{ $mostRecentPosition.end }} {{ else }} Present {{ end }}, + {{ .company.location }} +

+
+

{{ .company.overview | markdownify }}

+ {{ $totalPositions:= len .positions }} + {{ range $index,$position:= .positions }} +
{{ $position.designation }}
+

{{ $position.start }} - {{if $position.end }} {{ $position.end }} {{else}} Present {{end}}

+ +
+ {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/experiences/one-position.html b/layouts/partials/experiences/one-position.html new file mode 100644 index 0000000..c743f3a --- /dev/null +++ b/layouts/partials/experiences/one-position.html @@ -0,0 +1,17 @@ +
+
+
{{ .designation }}
+
{{ if .company.url }} {{end }} {{ .company.name }}
+ +

{{ .start }} - {{ if .end }} {{ .end }} {{ else }}Present{{ end }}, + {{ .company.location }} +

+
+

{{ .company.overview | markdownify }}

+
Responsibilities:
+ +
\ No newline at end of file