Make form and signature list use two-letter country codes (#336)

make form and signature list use two-letter country codes

Co-authored-by: max.mehl <max.mehl@fsfe.org>
lektura
Max Mehl 2020-04-22 13:31:18 +02:00
parent 238c0b1898
commit dc6157f5db
3 changed files with 16 additions and 15 deletions

View File

@ -10,7 +10,7 @@
"include_vars": {
"name": "Test Docker",
"confirm": "jonas@example.com",
"country": "Testland",
"country": "DE",
"zip": "64632",
"comment": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"permissionPriv": "yes",
@ -31,7 +31,7 @@
"include_vars": {
"name": "Test Testson",
"confirm": "jonas@example.com",
"country": "Sweden",
"country": "SE",
"zip": "64632",
"comment": "Hey Max! Lets see if this works.",
"permissionPriv": "yes",
@ -52,7 +52,7 @@
"include_vars": {
"name": "Test Testson 2",
"confirm": "jonas@example.com",
"country": "Sweden",
"country": "ABCDE",
"zip": "64632",
"comment": "Hey Max! Lets see if this works, AGAIN!",
"permissionPriv": "yes",
@ -95,7 +95,7 @@
"include_vars": {
"name": "Test Testson 2",
"confirm": "jonas@example.com",
"country": "Sweden",
"country": "AF",
"zip": "64632",
"comment": "Hey Max! Lets see if this works, AGAIN! With timestamp.",
"permissionPriv": "yes",
@ -117,7 +117,7 @@
"include_vars": {
"name": "Max1",
"confirm": "mail@example.org",
"country": "Belgium",
"country": "BE",
"zip": "12345",
"comment": "",
"permissionPriv": "yes",
@ -139,7 +139,7 @@
"include_vars": {
"name": "Max3",
"confirm": "tech+blah@example.org",
"country": "Netherlands",
"country": "NL",
"zip": "66816",
"comment": "mail with + and not appear in list",
"permissionPriv": "yes",
@ -160,7 +160,7 @@
"include_vars": {
"name": "Max2",
"confirm": "mail@example.org",
"country": "Bulgaria",
"country": "BG",
"zip": "68168",
"comment": "This is the same email as Max1",
"permissionPriv": "yes",
@ -182,7 +182,7 @@
"include_vars": {
"name": "Fan",
"confirm": "tech@example.org",
"country": "Czech Republic",
"country": "CZ",
"zip": "26168",
"comment": "Yeah",
"permissionPriv": "yes",
@ -203,7 +203,7 @@
"include_vars": {
"name": "Test2",
"confirm": "tech+2@example.org",
"country": "Portugal",
"country": "PT",
"zip": "6168",
"comment": "Test again",
"permissionPriv": "yes",
@ -224,7 +224,7 @@
"include_vars": {
"name": "HIDDEN",
"confirm": "tech@example.org",
"country": "Luxembourg",
"country": "LU",
"zip": "51684168",
"comment": "Crazy <3 \"\" symbols ' // %$ \\",
"permissionPriv": "yes",

View File

@ -12,7 +12,7 @@
<option value="">{{ i18n "action_form_country" }}</option>
{{ $json := getJSON "data/countries/countries.json" }}
{{ range sort $json "name" "asc" }}
<option value="{{ .name }}">{{ .name }}</option>
<option value="{{ .genc2a }}">{{ .name }}</option>
{{ end }}
</select>
</label>

View File

@ -8,13 +8,14 @@
</tr>
</thead>
<tbody>
{{ $json := getJSON "data/signatures/signatures.json" }}
{{ $json := where $json "include_vars.permissionPub" "yes" }}
{{ $signatures := getJSON "data/signatures/signatures.json" }}
{{ $signatures := where $signatures "include_vars.permissionPub" "yes" }}
{{ $countries := getJSON "data/countries/countries.json" }}
{{ range sort $json "timestamp" "desc" }}
{{ range sort $signatures "timestamp" "desc" }}
<tr>
<td>{{ .include_vars.name }}</td>
<td>{{ .include_vars.country }}</td>
<td>{{ (index (where $countries "genc2a" .include_vars.country) 0).name | default .include_vars.country}}</td> <!-- finds the two-letter code in countries.json (first match), and prints the full name -->
<td>{{ .include_vars.comment }}</td>
</tr>
{{ end }}