From a1a54d2ba8dd075e896257cfe946b55f0eae3269 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 21 Sep 2024 11:37:50 +0200 Subject: Port the /coins/designs page --- src/http.go | 14 +++++++++++++- src/rosetta/bg/messages.gotext.json | 15 +++++++++++++++ src/rosetta/el/messages.gotext.json | 15 +++++++++++++++ src/rosetta/en/messages.gotext.json | 21 +++++++++++++++++++++ src/rosetta/nl/messages.gotext.json | 15 +++++++++++++++ src/templates.go | 1 + src/templates/coins-designs.html.tmpl | 31 +++++++++++++++++++++++++++++++ 7 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 src/templates/coins-designs.html.tmpl 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 @@ -216,6 +216,21 @@ "message": "Feel free to contact us!", "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", 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 @@ -216,6 +216,21 @@ "message": "Feel free to contact us!", "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", 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 @@ -302,6 +302,27 @@ "translatorComment": "Copied from source.", "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", 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 @@ -216,6 +216,21 @@ "message": "Feel free to contact us!", "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", 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" }} +
+ {{ template "navbar" . }} +

{{ .T "Euro Coin Designs" }}

+
+
+

+ {{ .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.` + `` `` | safe + }} +

+
+
+ {{ $p := .Printer }} + {{ range .Countries }} + + {{ $p.T .Name }} + + {{ end }} +
+
+{{ end }} -- cgit v1.2.3