aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/templates/coins-mintages.html.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/coins-mintages.html.tmpl')
-rw-r--r--src/templates/coins-mintages.html.tmpl91
1 files changed, 54 insertions, 37 deletions
diff --git a/src/templates/coins-mintages.html.tmpl b/src/templates/coins-mintages.html.tmpl
index 7c041f3..e5fa5f1 100644
--- a/src/templates/coins-mintages.html.tmpl
+++ b/src/templates/coins-mintages.html.tmpl
@@ -9,6 +9,10 @@
position: sticky;
left: 0;
}
+
+ .striped :is(th, td) {
+ background-color: var(--pico-table-row-stripped-background-color);
+ }
}
label[for="country-dd"] { display: none; }
@@ -99,11 +103,12 @@
</div>
<button type="submit">{{ .GetC "Filter" "Header/Label" }}</button>
</form>
+
+ {{ if and (eq .FilterBy "country")
+ (gt (len .CountryMintages.Standard) 0) }}
<figure>
<figcaption>{{ .Get "Standard Issue Coins" }}</figcaption>
<div class="overflow-auto">
- {{ if eq .FilterBy "country" }}
-
<table class="mintage-table striped" role="grid">
<thead>
<th>{{ .GetC "Year" "Header/Label" }}</th>
@@ -122,8 +127,8 @@
<tr>
<th scope="row">
{{- .Year -}}
- {{- if ne .Mintmark "" -}}
- &nbsp;<sub><small>{{ .Mintmark }}</small></sub>
+ {{- if .Mintmark.Valid -}}
+ &nbsp;<sub><small>{{ .Mintmark.V }}</small></sub>
{{- end -}}
</th>
{{ range .Mintages }}
@@ -133,9 +138,15 @@
{{ end }}
</tbody>
</table>
+ </div>
+ </figure>
- {{ else if eq .FilterBy "year" }}
+ {{ else if and (eq .FilterBy "year")
+ (gt (len .YearMintages.Standard) 0) }}
+ <figure>
+ <figcaption>{{ .Get "Standard Issue Coins" }}</figcaption>
+ <div class="overflow-auto">
<table class="mintage-table striped" role="grid">
<thead>
<th>{{ .GetC "Country" "Header/Label" }}</th>
@@ -154,8 +165,8 @@
<tr>
<th scope="row">
{{- .Country -}}
- {{- if ne .Mintmark "" -}}
- &nbsp;<sub><small>{{ .Mintmark }}</small></sub>
+ {{- if .Mintmark.Valid -}}
+ &nbsp;<sub><small>{{ .Mintmark.V }}</small></sub>
{{- end -}}
</th>
{{ range .Mintages }}
@@ -165,15 +176,15 @@
{{ end }}
</tbody>
</table>
- {{ end }}
</div>
</figure>
+ {{ end }}
{{ if eq .FilterBy "country" }}
{{ if ne (len .CountryMintages.Commemorative) 0 }}
<figure>
<figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
- <table class="mintage-table striped" role="grid">
+ <table class="mintage-table" role="grid">
<thead>
<th>{{ .GetC "Year" "Header/Label" }}</th>
<th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
@@ -181,21 +192,25 @@
</thead>
<tbody>
{{ $p := .Printer }}
- {{ range .CountryMintages.Commemorative }}
- <tr>
- <th scope="row">
- {{- .Year -}}
- {{- if ne .Mintmark "" -}}
- &nbsp;<sub><small>{{ .Mintmark }}</small></sub>
+ {{ range $i, $ := .CountryMintages.Commemorative }}
+ {{ $y := .Year }}
+ {{ $mm := .Mintmark }}
+ {{ $ccs := .CCs }}
+ {{ range $j, $cc := .CCs }}
+ <tr {{ if evenp $i }}class="striped"{{ end }}>
+ {{ if eq $j 0 }}
+ <th scope="row" rowspan="{{ len $ccs }}">
+ {{- $y -}}
+ {{- if $mm.Valid -}}
+ &nbsp;<sub><small>{{ $mm.V }}</small></sub>
{{- end -}}
</th>
- <!-- TODO: Translate commemorative names -->
- <td>{{ .Name }}</td>
- {{ with .Mintage }}
- {{ template "mintages/mintage-cell" (tuple . $p) }}
{{ end }}
+ <td>{{ $p.GetC .Name "CC Name" }}</td>
+ {{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
</tr>
{{ end }}
+ {{ end }}
</tbody>
</table>
</figure>
@@ -206,7 +221,7 @@
{{ if ne (len .YearMintages.Commemorative) 0 }}
<figure>
<figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
- <table class="mintage-table striped" role="grid">
+ <table class="mintage-table" role="grid">
<thead>
<th>{{ .GetC "Country" "Header/Label" }}</th>
<th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
@@ -214,21 +229,25 @@
</thead>
<tbody>
{{ $p := .Printer }}
- {{ range .YearMintages.Commemorative }}
- <tr>
- <th scope="row">
- {{- .Country -}}
- {{- if ne .Mintmark "" -}}
- &nbsp;<sub><small>{{ .Mintmark }}</small></sub>
+ {{ range $i, $ := .YearMintages.Commemorative }}
+ {{ $c := .Country }}
+ {{ $mm := .Mintmark }}
+ {{ $ccs := .CCs }}
+ {{ range $j, $cc := .CCs }}
+ <tr {{ if evenp $i }}class="striped"{{ end }}>
+ {{ if eq $j 0 }}
+ <th scope="row" rowspan="{{ len $ccs }}">
+ {{- $c -}}
+ {{- if $mm.Valid -}}
+ &nbsp;<sub><small>{{ $mm.V }}</small></sub>
{{- end -}}
</th>
- <!-- TODO: Translate commemorative names -->
- <td>{{ .Name }}</td>
- {{ with .Mintage }}
- {{ template "mintages/mintage-cell" (tuple . $p) }}
{{ end }}
+ <td>{{ $p.GetC .Name "CC Name" }}</td>
+ {{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
</tr>
{{ end }}
+ {{ end }}
</tbody>
</table>
</figure>
@@ -271,13 +290,11 @@
{{ define "mintages/mintage-cell" }}
{{ $v := index . 0 }}
{{ $p := index . 1 }}
-{{ if eq $v -1 }}
- <td data-numeric>{{ $p.Get "Unknown" }}</td>
-{{ else if eq $v -2 }}
- <td data-numeric class="error">{{ $p.Get "Error" }}</td>
-{{ else if eq $v 0 }}
+{{ if not $v.Valid }}
+ <td data-numeric>{{ $p.GetC "Unknown" "Header/Label" }}</td>
+{{ else if eq $v.V 0 }}
<td data-numeric>—</td>
{{ else }}
- <td data-numeric>{{ $p.Itoa $v }}</td>
-{{ end }}
+ <td data-numeric>{{ $p.Itoa $v.V }}</td>
{{ end }}
+{{ end }} \ No newline at end of file