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.tmpl392
1 files changed, 266 insertions, 126 deletions
diff --git a/src/templates/coins-mintages.html.tmpl b/src/templates/coins-mintages.html.tmpl
index 8c60248..5b0a7fd 100644
--- a/src/templates/coins-mintages.html.tmpl
+++ b/src/templates/coins-mintages.html.tmpl
@@ -1,160 +1,300 @@
+{{ define "header" }}
+{{ template "header-navbar" . }}
+
+<style>
+ .mintage-table {
+ white-space: nowrap;
+
+ tr :is(th, td):first-child {
+ position: sticky;
+ left: 0;
+ }
+
+ .striped :is(th, td) {
+ background-color: var(--pico-table-row-stripped-background-color);
+ }
+ }
+
+ label[for="country-dd"] { display: none; }
+ label[for="year-dd"] { display: none; }
+
+ form {
+ &:has(#country:checked) {
+ label[for="country-dd"] { display: unset; }
+ }
+ &:has(#year:checked) {
+ label[for="year-dd"] { display: unset; }
+ }
+ }
+</style>
+{{ end }}
+
{{ define "content" }}
-<header>
+<header class="container">
{{ template "navbar" . }}
- <h1>{{ .T "Euro Coin Mintages" }}</h1>
+ <h1>{{ .Get "Euro Coin Mintages" }}</h1>
</header>
-<main>
+<main class="container">
<p>
- {{ .T `
- Here you’ll be able to view all the known mintages for all
- coins. You’ll also be able to filter on country, denomination,
- etc. If you have any mintage data that’s missing from our site,
- feel free to contact us.
- ` }}
+ {{ .Get "Here you’ll be able to view all the known mintages for all coins. You’ll also be able to filter on country, denomination, etc. If you have any mintage data that’s missing from our site, feel free to contact us." }}
</p>
- <hr />
+ <hr>
{{ if eq .Code "nl" }}
- <h2>{{ .T "Additional Notes" }}</h2>
- <ul>
- <li>
- {{ .T `
- Most coins from the years 2003–2016 are listed as NIFC coins
- while other popular sources such as Numista claim they were
- minted for circulation. For more information on why others are
- wrong, %sclick here%s.`
- `<a href="#TODO">` `</a>` | safe
- }}
- </li>
- <li>
- {{ .T `
- In 2003 Numista calculated a total of %d coins issued for coin
- sets per denomination. Our own calculations found only
- %d. Numista also forgot to include the many hundred thousand
- coins from the coin roll sets that were produced.`
- 217503 177003
- }}
- </li>
- </ul>
+ <h2>{{ .Get "Additional Notes" }}</h2>
+ <ul>
+ <li>
+ {{ .Get "Most coins from the years 2003–2016 are listed as NIFC coins while other popular sources such as Numista claim they were minted for circulation. For more information on why others are wrong, {Link:l}click here{-:E}."
+ (map "Link" "#TODO") }}
+ </li>
+ </ul>
{{ end }}
- <section>
- <form>
- <div class="grid">
- <label for="country-dd">
- {{ .T "Country" }}
- <select id="country-dd" name="code">
- {{ $code := .Code }}
- {{ range .Countries }}
- <option
- value={{ .Code }}
- {{ if eq .Code $code }}
- selected
- {{ end }}
- >
- {{ .Name }}
- </option>
- {{ end }}
- </select>
- </label>
- <fieldset>
- {{ template "coin-type-radio"
- (tuple .Type "circ" (.T "Circulation Coins")) }}
- {{ template "coin-type-radio"
- (tuple .Type "nifc" (.T "NIFC / BU Sets")) }}
- {{ template "coin-type-radio"
- (tuple .Type "proof" (.T "Proof Coins")) }}
- </fieldset>
- </div>
- <button type="submit">{{ .T "Filter" }}</button>
- </form>
- <figure>
- <figcaption>{{ .T "Standard Issue Coins" }}</figcaption>
- <table class="mintage-table" role="grid">
- <thead>
- <th>{{ .T "Year" }}</th>
- {{ with $p := .Printer }}
- {{ range denoms }}
- <th>{{ $p.M . }}</th>
- {{ end }}
+ <form>
+ <div class="grid">
+ <fieldset>
+ <legend>{{ .GetC "Filter Method" "Header/Label" }}</legend>
+ {{ template "mintages/filter-radio"
+ (tuple .FilterBy "country" (.GetC "Country" "Header/Label")) }}
+ {{ template "mintages/filter-radio"
+ (tuple .FilterBy "year" (.GetC "Year" "Header/Label")) }}
+ </fieldset>
+
+ <label for="country-dd">
+ {{ .GetC "Country" "Header/Label" }}
+ <select id="country-dd" name="country">
+ {{ $code := .Code }}
+ {{ range .Countries }}
+ <option
+ value="{{ .Code }}"
+ {{ if eq .Code $code }}
+ selected
+ {{ end }}
+ >
+ {{ .Name }}
+ </option>
{{ end }}
+ </select>
+ </label>
+
+ <label for="year-dd">
+ {{ .GetC "Year" "Header/Label" }}
+ <select id="year-dd" name="year">
+ {{ $year := .Year }}
+ {{ range years }}
+ <option
+ value="{{ . }}"
+ {{ if eq . $year }}
+ selected
+ {{ end }}
+ >
+ {{ . }}
+ </option>
+ {{ end }}
+ </select>
+ </label>
+
+ <fieldset>
+ {{ template "mintages/coin-type-radio"
+ (tuple .Type "circ" (.GetC "Circulation Coins" "Header/Label")) }}
+ {{ template "mintages/coin-type-radio"
+ (tuple .Type "nifc" (.GetC "NIFC and BU Coins" "Header/Label")) }}
+ {{ template "mintages/coin-type-radio"
+ (tuple .Type "proof" (.GetC "Proof Coins" "Header/Label")) }}
+ </fieldset>
+ </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">
+ <table class="mintage-table striped" role="grid">
+ <thead>
+ <th>{{ .GetC "Year" "Header/Label" }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.01 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.02 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.05 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.10 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.20 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.50 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 1.00 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 2.00 }}</th>
</thead>
<tbody>
{{ $p := .Printer }}
- {{ $type := .Type }}
- {{ range .Mintages.Standard }}
+ {{ range .CountryMintages.Standard }}
<tr>
- <th scope="col">
+ <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 (index .Mintages (strToCtype $type)) }}
- {{ if eq . -1 }}
- <td>{{ $p.T "Unknown" }}</td>
- {{ else if eq . 0 }}
- <td>—</td>
- {{ else }}
- <td>{{ $p.N . }}</td>
- {{ end }}
- </td>
+ {{ range .Mintages }}
+ {{ template "mintages/mintage-cell" (tuple . $p) }}
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
+ </div>
+ </figure>
+
+ {{ 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>
+ <th data-numeric>{{ .Printer.Ftom 0.01 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.02 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.05 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.10 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.20 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 0.50 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 1.00 }}</th>
+ <th data-numeric>{{ .Printer.Ftom 2.00 }}</th>
+ </thead>
+ <tbody>
+ {{ $p := .Printer }}
+ {{ range .YearMintages.Standard }}
+ <tr>
+ <th scope="row">
+ {{- .Country -}}
+ {{- if .Mintmark.Valid -}}
+ &nbsp;<sub><small>{{ .Mintmark.V }}</small></sub>
+ {{- end -}}
+ </th>
+ {{ range .Mintages }}
+ {{ template "mintages/mintage-cell" (tuple . $p) }}
+ {{ end }}
+ </tr>
+ {{ end }}
+ </tbody>
+ </table>
+ </div>
+ </figure>
+ {{ end }}
+
+ {{ if eq .FilterBy "country" }}
+ {{ if ne (len .CountryMintages.Commemorative) 0 }}
+ <figure>
+ <figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
+ <table class="mintage-table" role="grid">
+ <thead>
+ <th>{{ .GetC "Year" "Header/Label" }}</th>
+ <th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
+ <th data-numeric>{{ .GetC "Mintage" "Header/Label" }}</th>
+ </thead>
+ <tbody>
+ {{ $p := .Printer }}
+ {{ 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>
+ {{ end }}
+ <td>{{ $p.GetC .Name "CC Name" }}</td>
+ {{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
+ </tr>
+ {{ end }}
+ {{ end }}
+ </tbody>
+ </table>
</figure>
- {{ if ne (len .Mintages.Commemorative) 0 }}
- <figure>
- <figcaption>{{ .T "Commemorative Coins" }}</figcaption>
- <table class="mintage-table-cc" role="grid">
- <thead>
- <th>{{ .T "Year" }}</th>
- <th>{{ .T "Commemorated Issue" }}</th>
- <th>{{ .T "Mintage" }}</th>
- </thead>
- <tbody>
- {{ $p := .Printer }}
- {{ $type := .Type }}
- {{ range .Mintages.Commemorative }}
- <tr>
- <th scope="col">
- {{- .Year -}}
- {{- if ne .Mintmark "" -}}
- &nbsp;<sub><small>{{ .Mintmark }}</small></sub>
- {{- end -}}
- </th>
- <!-- TODO: Translate commemorative names -->
- <td>{{ .Name }}</td>
- {{ with (index .Mintage (strToCtype $type)) }}
- {{ if eq . -1 }}
- <td>{{ $p.T "Unknown" }}</td>
- {{ else if eq . 0 }}
- <td>—</td>
- {{ else }}
- <td>{{ $p.N . }}</td>
- {{ end }}
- {{ end }}
- </tr>
+ {{ end }}
+
+ {{ else if eq .FilterBy "year" }}
+
+ {{ if ne (len .YearMintages.Commemorative) 0 }}
+ <figure>
+ <figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
+ <table class="mintage-table" role="grid">
+ <thead>
+ <th>{{ .GetC "Country" "Header/Label" }}</th>
+ <th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
+ <th data-numeric>{{ .GetC "Mintage" "Header/Label" }}</th>
+ </thead>
+ <tbody>
+ {{ $p := .Printer }}
+ {{ 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>
{{ end }}
- </tbody>
- </table>
- </figure>
+ <td>{{ $p.GetC .Name "CC Name" }}</td>
+ {{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
+ </tr>
+ {{ end }}
+ {{ end }}
+ </tbody>
+ </table>
+ </figure>
{{ end }}
- </section>
+ {{ end }}
</main>
{{ end }}
-{{ define "coin-type-radio" }}
-<label for=compact-{{ index . 1 }}>
+{{ define "mintages/coin-type-radio" }}
+<label for="{{ index . 1 }}">
<input
- id=compact-{{ index . 1 }}
+ id="{{ index . 1 }}"
name="type"
type="radio"
- value={{ index . 1 }}
+ value="{{ index . 1 }}"
{{ if eq (index . 0) (index . 1) }}
- checked
+ checked
{{ end }}
/>
{{ index . 2 }}
</label>
-{{ end }} \ No newline at end of file
+{{ end }}
+
+{{ define "mintages/filter-radio" }}
+{{ $v := index . 1 }}
+<label for="{{ $v }}">
+ <input
+ name="filter-by"
+ type="radio"
+ value="{{ $v }}"
+ id="{{ $v }}"
+ {{ if eq (index . 0) $v }}
+ checked
+ {{ end }}
+ >
+ {{ index . 2 }}
+</label>
+{{ end }}
+
+{{ define "mintages/mintage-cell" }}
+{{ $v := index . 0 }}
+{{ $p := index . 1 }}
+{{ 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.V }}</td>
+{{ end }}
+{{ end }}