Toevoegen van uitgelicht evenement

This commit is contained in:
Michael Boelen 2023-06-15 19:42:21 +02:00
parent 7c8950f396
commit b5fa24bf99
2 changed files with 73 additions and 1 deletions

View file

@ -1,7 +1,30 @@
{{ define "main" }}
{{ $.Scratch.Set "highlighted_events" slice }}
{{ range .Pages }}
{{ if isset .Params "event_start" }}
{{ $event_start := .Params.event_start | time }}
{{ if le now $event_start }}
{{ $.Scratch.Add "highlighted_events" . }}
{{ end }}
{{ end }}
{{ end }}
{{ if (gt ($.Scratch.Get "highlighted_events" | len) 0) }}
<h2>Aankomende evenementen</h2>
<div class="three-column-grid">
{{ range $.Scratch.Get "highlighted_events" }}
{{ partial "show-highlighted-event.html" . }}
{{ end }}
</div>
{{ end }}
<h2>Overzicht</h2>
<section>
<ul class="list">
{{ range .Pages }}
{{ range .Pages.ByDate }}
<li>
<a class="link" href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a>
<hr class="hr-list">

View file

@ -0,0 +1,49 @@
<div>
<div class="highlight-box highlight-box-nluug">
<h3>{{ .Params.event_title }}</h3>
{{ $event_start := .Params.event_start | time }}
{{ if le now $event_start }}
{{ if .Params.event_cfp_link }}
{{ if .Params.event_cfp_start_date }}
{{ $event_cfp_start_date := .Params.event_cfp_start_date | time }}
{{ if le now $event_cfp_start_date }}
<p>De Call for Proposals opent op {{ .Params.event_cfp_start_date | time.Format ":date_full" }}.</p>
{{ else }}
{{ if .Params.event_cfp_end_date }}
{{ $event_cfp_end_date := .Params.event_cfp_end_date | time }}
{{ if ge now $event_cfp_end_date }}
<p>De Call for Proposals is gesloten na {{ $event_cfp_end_date }}. Mocht je toch nog een inzending hebben, neem dan contact op met de programmacommissie.</p>
{{ else }}
<p>CFP: <strong class="darkgreen">Actief</strong></p><a href="{{ .Params.event_cfp_link }}" class="button">Naar CFP</a>
{{ end }}
{{ else }}
<p>CFP: <strong class="darkgreen">Actief</strong></p><a href="{{ .Params.event_cfp_link }}" class="button">Naar CFP</a>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
<h3>{{ .Params.event_location }}</h3>
<p>{{ .Params.event_address.street_address }}<br>{{ .Params.event_address.postal_code }}, {{ .Params.event_address.city }}<br>{{ .Params.event_address.country_name }}</p>
{{ $compare_event_start_date := .Params.event_start | time.Format "2006-01-02" }}
{{ $compare_event_end_date := .Params.event_end | time.Format "2006-01-02" }}
{{ if eq $compare_event_start_date $compare_event_end_date }}
<h3>Datum en tijd</h3>
<p>Dit evenement {{ if ge now $event_start }}vond{{ else }}vindt{{ end}} plaats op {{ .Params.event_start | time.Format ":date_full" }} ({{ .Params.event_start | time.Format "15:04" }}-{{ .Params.event_end | time.Format "15:04" }}).</p>
{{ else }}
<h3>Data</h3>
<ul>
<li>Start evenement: {{ .Params.event_start | time.Format "2006-01-02 15:04" }}</li>
<li>Einde evenement: {{ .Params.event_end | time.Format "2006-01-02 15:04" }}</li>
</ul>
{{ end }}
<p><a class="button" href="{{ .RelPermalink }}">Meer informatie</a></p>
</div>
</div>