add a cancelled membership field

- allow membership to be cancelled and retain historical membership
- do not display any cancelled members in the listing and single pages

Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>
remotes/1693382392408915667/master
Toshaan Bharvani 2 years ago
parent f42d9e59bb
commit 89c6368538

@ -1,6 +1,7 @@
{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ partial "navbar.html" . }} {{ partial "navbar.html" . }}
{{ $i := 0 }} {{ $i := 0 }}
{{ $now := now.Format "20060102" }}
<main id="main" class="main members"> <main id="main" class="main members">
<div class="container"> <div class="container">
<section id="intro"> <section id="intro">
@ -24,20 +25,30 @@
{{ $level := .Param "level" }} {{ $level := .Param "level" }}
{{ if eq $level $key }} {{ if eq $level $key }}
<div class="col-lg-{{ $col }} pt-5 pb-0 pb-lg-3"> <div class="col-lg-{{ $col }} pt-5 pb-0 pb-lg-3">
<div class="box"> {{ $memberstatus := true }}
<a href="{{ .RelPermalink }}"> {{ $cancelled := now.Format "20060102" }}
{{ if .Param "image" }} {{ if isset .Params "cancelled" }}
{{ $imagename := .Param "image" }} {{ $cancelled = time (.Param "cancelled") | dateFormat "20060102" }}
{{ $imagelocation := (printf "%s/%s" "images/members/" $imagename) }} {{ if lt $cancelled $now }}
{{ $imageresource := resources.Get $imagelocation }} {{ $memberstatus = false }}
{{ $image := $imageresource.Fit $imagesize }}
<img src="{{ $image.RelPermalink }}" alt="{{ .Title }}" title="{{ .Title }}">
</a>
{{ else }}
<h3><a class="text-black" href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ end }} {{ end }}
{{ $i = add $i 1 }} {{ end }}
</div> {{ if eq $memberstatus true }}
<div class="box">
<a href="{{ .RelPermalink }}">
{{ if .Param "image" }}
{{ $imagename := .Param "image" }}
{{ $imagelocation := (printf "%s/%s" "images/members/" $imagename) }}
{{ $imageresource := resources.Get $imagelocation }}
{{ $image := $imageresource.Fit $imagesize }}
<img src="{{ $image.RelPermalink }}" alt="{{ .Title }}" title="{{ .Title }}">
</a>
{{ else }}
<h3><a class="text-black" href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ end }}
{{ $i = add $i 1 }}
</div>
{{ end }}
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}

@ -1,3 +1,14 @@
{{ $now := now.Format "20060102" }}
{{ $memberstatus := true }}
{{ $cancelled := now.Format "20060102" }}
{{ if isset .Params "cancelled" }}
{{ $cancelled = time (.Param "cancelled") | dateFormat "20060102" }}
{{ if lt $cancelled $now }}
{{ $memberstatus = false }}
{{ end }}
{{ end }}
{{ if eq $memberstatus true }}

{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ partial "navbar.html" . }} {{ partial "navbar.html" . }}
<main id="main"> <main id="main">
@ -69,3 +80,5 @@
</section> </section>
</main> </main>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

{{ end }}

@ -3,6 +3,9 @@
"permalink": "{{ .RelPermalink }}", "permalink": "{{ .RelPermalink }}",
"level": "{{ .Params.level }}", "level": "{{ .Params.level }}",
"joined": "{{ .Params.joined }}", "joined": "{{ .Params.joined }}",
{{ if isset .Params "cancelled" }}
"cancelled": "{{ time (.Param "cancelled") | dateFormat "20060102" }}",
{{ end }}
"link": "{{ .Params.link }}", "link": "{{ .Params.link }}",
"content": "{{ .PlainWords }}" "content": "{{ .PlainWords }}"
} }

Loading…
Cancel
Save