From 334a4ffe59286c0ca1d605b9a89155cbf2aa1eae Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 3 Aug 2025 02:29:50 +0200 Subject: Improve table styling on mobile --- src/templates.go | 14 ++- src/templates/coins-designs-ee.html.tmpl | 175 ++++++++++++++++++++----------- 2 files changed, 123 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/templates.go b/src/templates.go index 2721f92..a553766 100644 --- a/src/templates.go +++ b/src/templates.go @@ -120,7 +120,10 @@ func ifElse(b bool, x, y any) any { return y } -func withTranslation(tag, bcp, text string, trans template.HTML) template.HTML { +func withTranslation(tag, bcp, text string, trans template.HTML, + spanAttrs ...string) template.HTML { + name, _, _ := strings.Cut(tag, " ") + var bob strings.Builder bob.WriteByte('<') bob.WriteString(tag) @@ -131,13 +134,18 @@ func withTranslation(tag, bcp, text string, trans template.HTML) template.HTML { bob.WriteString("") if text != string(trans) { - bob.WriteString(`
`) + bob.WriteString(`
') bob.WriteString(string(trans)) bob.WriteString("") } bob.WriteString("') return template.HTML(bob.String()) } diff --git a/src/templates/coins-designs-ee.html.tmpl b/src/templates/coins-designs-ee.html.tmpl index 53cb35b..5f41f29 100644 --- a/src/templates/coins-designs-ee.html.tmpl +++ b/src/templates/coins-designs-ee.html.tmpl @@ -1,5 +1,52 @@ {{ define "header" }} {{ template "header-navbar" . }} + + {{ end }} {{ define "content" }} @@ -23,7 +70,7 @@ (map "Link" (.Printer.Wikipedia "Eurovision Song Contest")) }}

- {{ .Get "In June 2004 a public design competition was announced with a deadline for the 19th of October. In total 134 designs were submitted by the deadline and 10 designs were selected by a jury. These 10 designs were then voted on in a public vote over the course of one week. In total 45,453 people voted and the current design won with a total of 12,482 votes (27.46%)." }} + {{ .Get "In June 2004 a public design competition was announced with a deadline for the 19th of October. A total of 134 designs were submitted by the deadline and of these submissions, 10 were picked by a jury to partake in the public vote over the course of one week. In total, 45,453 people voted and the current design won with a total of 12,482 votes (27.46%)." }}

{{ .Get "The winner of the contest was awarded 50,000 KR (€3,196) while the other finalists were each awarded 20,000 KR (€1,278)." }} @@ -32,7 +79,7 @@ - +
@@ -42,93 +89,95 @@ - + {{ $args := map "Break" "
" }} + {{ $tag := printf `td data-label="%s"` (.Get "Name") }} + {{ $attr := printf `data-label="%s"` (.Get "Translation") }} - + {{/* TRANSLATORS: Name of a coin design. Don’t translate unless you use a non-latin script */}} - {{ withTranslation "td" "et" "Hara 2" - (.Get "Hara 2") }} - - - + {{ withTranslation $tag "et" "Hara 2" + (.Get "Hara 2") $attr }} + + + - - {{ withTranslation "td" "et" "Järjepidevus" - (.Get "Consistency") }} - - - + + {{ withTranslation $tag "et" "Järjepidevus" + (.Get "Consistency") $attr }} + + + - - {{ withTranslation "td" "la" "In corpore" - (.Get "In the Body") }} - - - + + {{ withTranslation $tag "la" "In corpore" + (.Get "In the Body") $attr }} + + + - + {{/* TRANSLATORS: Name of a coin design. Don’t translate unless you use a non-latin script */}} - {{ withTranslation "td" "et" "Tomson 5791" - (.Get "Tomson 5791") }} - - - + {{ withTranslation $tag "et" "Tomson 5791" + (.Get "Tomson 5791") $attr }} + + + - - {{/* TRANSLATORS: Estonian Translatiors: Translate this to ‘Eesti keel’ */}} - {{ withTranslation "td" "et" "Eesti keel" - (.GetC "Estonian" "Language Name") }} - - - + + {{/* TRANSLATORS: Estonian Translators: ‘Estonian’ as in the language, not the nationality */}} + {{ withTranslation $tag "et" "Eesti keel" + (.GetC "Estonian" "Coin Design") $attr }} + + + - - - - - + + + + + - - {{ withTranslation "td" "et" "Linnutee" - (.Get "Bird Road") }} - - - + + {{ withTranslation $tag "et" "Linnutee" + (.Get "Bird Road") $attr }} + + + - - {{ withTranslation "td" "et" "Leopardid-2" - (.Get "Leopards-2") }} - - - + + {{ withTranslation $tag "et" "Leopardid-2" + (.Get "Leopards-2") $attr }} + + + - + {{/* TRANSLATORS: Name of a coin design. Don’t translate unless you use a non-latin script */}} - {{ withTranslation "td" "et" "Nova" - (.Get "Nova") }} - - - + {{ withTranslation $tag "et" "Nova" + (.Get "Nova") $attr }} + + + - - {{ withTranslation "td" "et" "Lill rukkis" - (.Get "A Flower in the Rye") }} - - - + + {{ withTranslation $tag "et" "Lill rukkis" + (.Get "A Flower in the Rye") $attr }} + + + -- cgit v1.2.3
{{ .Get "Position" }} {{ .Get "Author(s)" }} {{ .Get "Votes" }}{{ .Get "Votes (%)" }}{{ .Get "Votes (%)" }}
11{{ .Get "Lembit Lõhmus" }}{{ .Printer.Itoa 12482 }}{{ .Printer.Ftop 27.46 }}{{ .Get "Lembit Lõhmus" }}{{ .Printer.Itoa 12482 }}{{ .Printer.Ftop 27.46 }}
2{{ .Get "Tiit Jürna" }}{{ .Printer.Itoa 7477 }}{{ .Printer.Ftop 16.45 }}2{{ .Get "Tiit Jürna" }}{{ .Printer.Itoa 7477 }}{{ .Printer.Ftop 16.45 }}
3{{ .Get "Jaan Meristo" }}{{ .Printer.Itoa 7284 }}{{ .Printer.Ftop 16.03 }}3{{ .Get "Jaan Meristo" }}{{ .Printer.Itoa 7284 }}{{ .Printer.Ftop 16.03 }}
44{{ .Get "Taavi Torim" }}{{ .Printer.Itoa 6219 }}{{ .Printer.Ftop 13.68 }}{{ .Get "Taavi Torim" }}{{ .Printer.Itoa 6219 }}{{ .Printer.Ftop 13.68 }}
5{{ .Get "Jaak Peep, Villem Valme" }}{{ .Printer.Itoa 5997 }}{{ .Printer.Ftop 13.19 }}5{{ .Get "Jaak Peep, Villem Valme" }}{{ .Printer.Itoa 5997 }}{{ .Printer.Ftop 13.19 }}
6261948{{ .Get "Mai Järmut, Villu Järmut" }}{{ .Printer.Itoa 3036 }}{{ .Printer.Ftop 6.68 }}6261948{{ .Get "Mai Järmut, Villu Järmut" }}{{ .Printer.Itoa 3036 }}{{ .Printer.Ftop 6.68 }}
7{{ .Get "Tiit Jürna" }}{{ .Printer.Itoa 1323 }}{{ .Printer.Ftop 2.91 }}7{{ .Get "Tiit Jürna" }}{{ .Printer.Itoa 1323 }}{{ .Printer.Ftop 2.91 }}
8{{ .Get "Jaarno Ester" }}{{ .Printer.Itoa 759 }}{{ .Printer.Ftop 1.67 }}8{{ .Get "Jaarno Ester" }}{{ .Printer.Itoa 759 }}{{ .Printer.Ftop 1.67 }}
99{{ .Get "Rene Haljasmäe" }}{{ .Printer.Itoa 498 }}{{ .Printer.Ftop 1.1 }}{{ .Get "Rene Haljasmäe" }}{{ .Printer.Itoa 498 }}{{ .Printer.Ftop 1.1 }}
10{{ .Get "Margus Kadarik" }}{{ .Printer.Itoa 378 }}{{ .Printer.Ftop 0.83 }}10{{ .Get "Margus Kadarik" }}{{ .Printer.Itoa 378 }}{{ .Printer.Ftop 0.83 }}