diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-09-21 11:37:50 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-09-21 11:38:37 +0200 |
commit | a1a54d2ba8dd075e896257cfe946b55f0eae3269 (patch) | |
tree | a98d623d81892d0ab9e3bd92bed4d94af0ce74e9 /src | |
parent | a89a4ddcd930ba18fe923bdb4ebf40772a1cbb80 (diff) |
Port the /coins/designs page
Diffstat (limited to 'src')
-rw-r--r-- | src/http.go | 14 | ||||
-rw-r--r-- | src/rosetta/bg/messages.gotext.json | 15 | ||||
-rw-r--r-- | src/rosetta/el/messages.gotext.json | 15 | ||||
-rw-r--r-- | src/rosetta/en/messages.gotext.json | 21 | ||||
-rw-r--r-- | src/rosetta/nl/messages.gotext.json | 15 | ||||
-rw-r--r-- | src/templates.go | 1 | ||||
-rw-r--r-- | src/templates/coins-designs.html.tmpl | 31 |
7 files changed, 111 insertions, 1 deletions
diff --git a/src/http.go b/src/http.go index ca286de..e944af2 100644 --- a/src/http.go +++ b/src/http.go @@ -31,8 +31,14 @@ func Run(port int) { mux.Handle("GET /coins/mintages", chain( firstHandler, i18nHandler, + countryHandler, mintageHandler, )(final)) + mux.Handle("GET /coins/designs", chain( + firstHandler, + i18nHandler, + countryHandler, + )(final)) mux.Handle("GET /", chain( firstHandler, i18nHandler, @@ -111,11 +117,17 @@ func i18nHandler(next http.Handler) http.Handler { }) } -func mintageHandler(next http.Handler) http.Handler { +func countryHandler(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { td := r.Context().Value("td").(*templateData) td.Countries = sortedCountries(td.Printer) + next.ServeHTTP(w, r) + }) +} +func mintageHandler(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + td := r.Context().Value("td").(*templateData) td.Code = strings.ToLower(r.FormValue("code")) if !slices.ContainsFunc(td.Countries, func(c country) bool { return c.Code == td.Code diff --git a/src/rosetta/bg/messages.gotext.json b/src/rosetta/bg/messages.gotext.json index ec9e7c3..2091291 100644 --- a/src/rosetta/bg/messages.gotext.json +++ b/src/rosetta/bg/messages.gotext.json @@ -217,6 +217,21 @@ "translation": "" }, { + "id": "Euro Coin Designs", + "message": "Euro Coin Designs", + "translation": "" + }, + { + "id": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "message": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "translation": "" + }, + { + "id": "\u003ca href=\"/coins/varieties\"\u003e", + "message": "\u003ca href=\"/coins/varieties\"\u003e", + "translation": "" + }, + { "id": "Euro Coin Mintages", "message": "Euro Coin Mintages", "translation": "" diff --git a/src/rosetta/el/messages.gotext.json b/src/rosetta/el/messages.gotext.json index f3e85e3..b407ced 100644 --- a/src/rosetta/el/messages.gotext.json +++ b/src/rosetta/el/messages.gotext.json @@ -217,6 +217,21 @@ "translation": "" }, { + "id": "Euro Coin Designs", + "message": "Euro Coin Designs", + "translation": "" + }, + { + "id": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "message": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "translation": "" + }, + { + "id": "\u003ca href=\"/coins/varieties\"\u003e", + "message": "\u003ca href=\"/coins/varieties\"\u003e", + "translation": "" + }, + { "id": "Euro Coin Mintages", "message": "Euro Coin Mintages", "translation": "" diff --git a/src/rosetta/en/messages.gotext.json b/src/rosetta/en/messages.gotext.json index a0c5986..a0b54d9 100644 --- a/src/rosetta/en/messages.gotext.json +++ b/src/rosetta/en/messages.gotext.json @@ -303,6 +303,27 @@ "fuzzy": true }, { + "id": "Euro Coin Designs", + "message": "Euro Coin Designs", + "translation": "Euro Coin Designs", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "message": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "translation": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { + "id": "\u003ca href=\"/coins/varieties\"\u003e", + "message": "\u003ca href=\"/coins/varieties\"\u003e", + "translation": "\u003ca href=\"/coins/varieties\"\u003e", + "translatorComment": "Copied from source.", + "fuzzy": true + }, + { "id": "Euro Coin Mintages", "message": "Euro Coin Mintages", "translation": "Euro Coin Mintages", diff --git a/src/rosetta/nl/messages.gotext.json b/src/rosetta/nl/messages.gotext.json index 0ddb8d9..8f80176 100644 --- a/src/rosetta/nl/messages.gotext.json +++ b/src/rosetta/nl/messages.gotext.json @@ -217,6 +217,21 @@ "translation": "" }, { + "id": "Euro Coin Designs", + "message": "Euro Coin Designs", + "translation": "" + }, + { + "id": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "message": "Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", + "translation": "" + }, + { + "id": "\u003ca href=\"/coins/varieties\"\u003e", + "message": "\u003ca href=\"/coins/varieties\"\u003e", + "translation": "" + }, + { "id": "Euro Coin Mintages", "message": "Euro Coin Mintages", "translation": "" diff --git a/src/templates.go b/src/templates.go index 712e7ec..787fd04 100644 --- a/src/templates.go +++ b/src/templates.go @@ -24,6 +24,7 @@ var ( "/": buildTemplate("index"), "/about": buildTemplate("about"), "/coins": buildTemplate("coins"), + "/coins/designs": buildTemplate("coins-designs"), "/coins/mintages": buildTemplate("coins-mintages"), "/jargon": buildTemplate("jargon"), "/language": buildTemplate("language"), diff --git a/src/templates/coins-designs.html.tmpl b/src/templates/coins-designs.html.tmpl new file mode 100644 index 0000000..6f82c5e --- /dev/null +++ b/src/templates/coins-designs.html.tmpl @@ -0,0 +1,31 @@ +{{ define "content" }} +<header> + {{ template "navbar" . }} + <h1>{{ .T "Euro Coin Designs" }}</h1> +</header> +<main> + <p> + {{ .T ` + Here you’ll be able to view all the coin designs for each country + in the Eurozone. This section of the site doesn’t include minor + varieties such as different mintmarks or errors; those are on the + %svarieties%s page.` + `<a href="/coins/varieties">` `</a>` | safe + }} + </p> + <hr /> + <div class="country-grid"> + {{ $p := .Printer }} + {{ range .Countries }} + <a + class="outline" + data-code={{ toUpper .Code }} + role="button" + href=/coins/designs/{{ .Code }} + > + {{ $p.T .Name }} + </a> + {{ end }} + </div> +</main> +{{ end }} |