From cf527ce07085dc3bd62f6cff821172c74c2706cc Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Sun, 21 Jan 2024 20:50:04 +0100 Subject: [PATCH] =?UTF-8?q?Add=20the=20application=E2=80=99s=20version=20t?= =?UTF-8?q?o=20the=20footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is mostly because it is required for the “Digital Kit”, but it also works in our favor because now i can version the URL to the static resources. Go 1.18 adds the info from git if the package is build from a git repository, but this is not the case in OBS, so i instead relay on a constant for the version number. This constant is “updated” by Debian’s rules, mostly due to the discussion in [0]. [0]: https://github.com/golang/go/issues/22706 --- debian/rules | 4 +++ pkg/build/version.go | 3 ++ pkg/template/render.go | 4 +++ po/ca.po | 32 +++++++++++-------- po/es.po | 32 +++++++++++-------- po/fr.po | 32 +++++++++++-------- web/static/camper.css | 9 ++++++ .../admin/campsite/feature/form.gohtml | 2 +- web/templates/admin/campsite/index.gohtml | 2 +- web/templates/admin/layout.gohtml | 9 ++++-- web/templates/admin/media/picker.gohtml | 2 +- web/templates/admin/media/upload.gohtml | 2 +- web/templates/admin/season/calendar.gohtml | 2 +- web/templates/admin/services/form.gohtml | 2 +- web/templates/public/layout.gohtml | 4 +-- 15 files changed, 88 insertions(+), 53 deletions(-) create mode 100644 pkg/build/version.go diff --git a/debian/rules b/debian/rules index caa8dd0..e3c43cc 100755 --- a/debian/rules +++ b/debian/rules @@ -1,9 +1,13 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk + %: dh $@ --builddirectory=_build --buildsystem=golang --with=golang execute_before_dh_auto_build: + printf 'package build\n\nconst Version = "%s"\n' "$(DEB_VERSION_UPSTREAM)" > pkg/build/version.go + cp pkg/build/version.go _build/src/dev.tandem.ws/tandem/camper/pkg/build/version.go make execute_after_dh_auto_test: diff --git a/pkg/build/version.go b/pkg/build/version.go new file mode 100644 index 0000000..411e2a2 --- /dev/null +++ b/pkg/build/version.go @@ -0,0 +1,3 @@ +package build + +const Version = "1.0~git" diff --git a/pkg/template/render.go b/pkg/template/render.go index cd5a450..57314b4 100644 --- a/pkg/template/render.go +++ b/pkg/template/render.go @@ -22,6 +22,7 @@ import ( "golang.org/x/text/number" "dev.tandem.ws/tandem/camper/pkg/auth" + "dev.tandem.ws/tandem/camper/pkg/build" httplib "dev.tandem.ws/tandem/camper/pkg/http" ) @@ -72,6 +73,9 @@ func MustRenderPublicFiles(w io.Writer, r *http.Request, user *auth.User, compan func mustRenderLayout(w io.Writer, user *auth.User, company *auth.Company, templateFile func(string) string, data interface{}, templates ...string) { t := template.New(templates[len(templates)-1]) t.Funcs(template.FuncMap{ + "camperVersion": func() string { + return build.Version + }, "gettext": user.Locale.Get, "pgettext": user.Locale.GetC, "currentLocale": func() string { diff --git a/po/ca.po b/po/ca.po index 38eedd8..46aee7e 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-18 20:54+0100\n" +"POT-Creation-Date: 2024-01-21 20:47+0100\n" "PO-Revision-Date: 2023-07-22 23:45+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -1238,6 +1238,10 @@ msgctxt "title" msgid "Bookings" msgstr "Reserves" +#: web/templates/admin/layout.gohtml:101 +msgid "Camper Version: %s" +msgstr "Camper versió: %s" + #: web/templates/admin/home/index.gohtml:11 msgctxt "title" msgid "Cover" @@ -1753,60 +1757,60 @@ msgstr "No podeu deixar el fitxer del mèdia en blanc." msgid "Filename can not be empty." msgstr "No podeu deixar el nom del fitxer en blanc." -#: pkg/booking/admin.go:148 +#: pkg/booking/admin.go:149 msgctxt "filename" msgid "bookings.ods" msgstr "reserves.ods" -#: pkg/booking/admin.go:176 +#: pkg/booking/admin.go:177 msgctxt "redsys environment" msgid "Test" msgstr "Proves" -#: pkg/booking/admin.go:180 +#: pkg/booking/admin.go:181 msgctxt "redsys environment" msgid "Live" msgstr "Real" -#: pkg/booking/admin.go:189 +#: pkg/booking/admin.go:190 msgctxt "redsys integration" msgid "InSite" msgstr "InSite" -#: pkg/booking/admin.go:193 +#: pkg/booking/admin.go:194 msgctxt "redsys integration" msgid "Redirect" msgstr "Redirecció" -#: pkg/booking/admin.go:237 +#: pkg/booking/admin.go:238 msgid "Merchant code can not be empty." msgstr "No podeu deixar el codi del comerç en blanc." -#: pkg/booking/admin.go:238 +#: pkg/booking/admin.go:239 msgid "Merchant code must be exactly nine digits long." msgstr "El codi del comerç ha de ser de nou dígits." -#: pkg/booking/admin.go:239 +#: pkg/booking/admin.go:240 msgid "Merchant code must be a number." msgstr "El codi del comerç." -#: pkg/booking/admin.go:243 +#: pkg/booking/admin.go:244 msgid "Terminal number can not be empty." msgstr "No podeu deixar el número del terminal en blanc." -#: pkg/booking/admin.go:244 +#: pkg/booking/admin.go:245 msgid "Terminal number must be a number between 1 and 999." msgstr "El número del terminal ha de ser entre 1 i 999" -#: pkg/booking/admin.go:252 +#: pkg/booking/admin.go:253 msgid "Selected environment is not valid." msgstr "L’entorn escollit no és vàlid." -#: pkg/booking/admin.go:253 +#: pkg/booking/admin.go:254 msgid "Selected integration is not valid." msgstr "La integració escollida no és vàlida." -#: pkg/booking/admin.go:256 +#: pkg/booking/admin.go:257 msgid "The merchant key is not valid." msgstr "Aquesta clau del comerç no és vàlid." diff --git a/po/es.po b/po/es.po index fac6062..d601a82 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-18 20:54+0100\n" +"POT-Creation-Date: 2024-01-21 20:47+0100\n" "PO-Revision-Date: 2023-07-22 23:46+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -1238,6 +1238,10 @@ msgctxt "title" msgid "Bookings" msgstr "Reservas" +#: web/templates/admin/layout.gohtml:101 +msgid "Camper Version: %s" +msgstr "Camper versión: %s" + #: web/templates/admin/home/index.gohtml:11 msgctxt "title" msgid "Cover" @@ -1753,60 +1757,60 @@ msgstr "No podéis dejar el archivo del medio en blanco." msgid "Filename can not be empty." msgstr "No podéis dejar el nombre del archivo en blanco." -#: pkg/booking/admin.go:148 +#: pkg/booking/admin.go:149 msgctxt "filename" msgid "bookings.ods" msgstr "reservas.ods" -#: pkg/booking/admin.go:176 +#: pkg/booking/admin.go:177 msgctxt "redsys environment" msgid "Test" msgstr "Pruebas" -#: pkg/booking/admin.go:180 +#: pkg/booking/admin.go:181 msgctxt "redsys environment" msgid "Live" msgstr "Real" -#: pkg/booking/admin.go:189 +#: pkg/booking/admin.go:190 msgctxt "redsys integration" msgid "InSite" msgstr "InSite" -#: pkg/booking/admin.go:193 +#: pkg/booking/admin.go:194 msgctxt "redsys integration" msgid "Redirect" msgstr "Redirección" -#: pkg/booking/admin.go:237 +#: pkg/booking/admin.go:238 msgid "Merchant code can not be empty." msgstr "No podéis dejar el código del comercio en blanco." -#: pkg/booking/admin.go:238 +#: pkg/booking/admin.go:239 msgid "Merchant code must be exactly nine digits long." msgstr "El código del comercio tiene que ser de nueve dígitos." -#: pkg/booking/admin.go:239 +#: pkg/booking/admin.go:240 msgid "Merchant code must be a number." msgstr "El código del comercio tiene que ser un número." -#: pkg/booking/admin.go:243 +#: pkg/booking/admin.go:244 msgid "Terminal number can not be empty." msgstr "No podéis dejar el número de terminal en blanco." -#: pkg/booking/admin.go:244 +#: pkg/booking/admin.go:245 msgid "Terminal number must be a number between 1 and 999." msgstr "El número de terminal tiene que ser entre 1 y 999." -#: pkg/booking/admin.go:252 +#: pkg/booking/admin.go:253 msgid "Selected environment is not valid." msgstr "El entorno escogido no es válido." -#: pkg/booking/admin.go:253 +#: pkg/booking/admin.go:254 msgid "Selected integration is not valid." msgstr "La integración escogida no es válida." -#: pkg/booking/admin.go:256 +#: pkg/booking/admin.go:257 msgid "The merchant key is not valid." msgstr "Esta clave del comercio no es válida." diff --git a/po/fr.po b/po/fr.po index 2607a74..cd4f719 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-18 20:54+0100\n" +"POT-Creation-Date: 2024-01-21 20:47+0100\n" "PO-Revision-Date: 2023-12-20 10:13+0100\n" "Last-Translator: Oriol Carbonell \n" "Language-Team: French \n" @@ -1239,6 +1239,10 @@ msgctxt "title" msgid "Bookings" msgstr "Réservations" +#: web/templates/admin/layout.gohtml:101 +msgid "Camper Version: %s" +msgstr "Camper version: %s" + #: web/templates/admin/home/index.gohtml:11 msgctxt "title" msgid "Cover" @@ -1754,60 +1758,60 @@ msgstr "Le fichier téléchargé ne peut pas être vide." msgid "Filename can not be empty." msgstr "Le nom de fichier ne peut pas être vide." -#: pkg/booking/admin.go:148 +#: pkg/booking/admin.go:149 msgctxt "filename" msgid "bookings.ods" msgstr "reservations.ods" -#: pkg/booking/admin.go:176 +#: pkg/booking/admin.go:177 msgctxt "redsys environment" msgid "Test" msgstr "Test" -#: pkg/booking/admin.go:180 +#: pkg/booking/admin.go:181 msgctxt "redsys environment" msgid "Live" msgstr "Live" -#: pkg/booking/admin.go:189 +#: pkg/booking/admin.go:190 msgctxt "redsys integration" msgid "InSite" msgstr "Insite" -#: pkg/booking/admin.go:193 +#: pkg/booking/admin.go:194 msgctxt "redsys integration" msgid "Redirect" msgstr "Redirection" -#: pkg/booking/admin.go:237 +#: pkg/booking/admin.go:238 msgid "Merchant code can not be empty." msgstr "Le code marchand ne peut pas être vide." -#: pkg/booking/admin.go:238 +#: pkg/booking/admin.go:239 msgid "Merchant code must be exactly nine digits long." msgstr "Le code marchand doit comporter exactement neuf chiffres." -#: pkg/booking/admin.go:239 +#: pkg/booking/admin.go:240 msgid "Merchant code must be a number." msgstr "Le code du commerçant doit être un chiffre." -#: pkg/booking/admin.go:243 +#: pkg/booking/admin.go:244 msgid "Terminal number can not be empty." msgstr "Le numéro de terminal ne peut pas être vide." -#: pkg/booking/admin.go:244 +#: pkg/booking/admin.go:245 msgid "Terminal number must be a number between 1 and 999." msgstr "Le numéro de terminal doit être compris entre 1 et 999." -#: pkg/booking/admin.go:252 +#: pkg/booking/admin.go:253 msgid "Selected environment is not valid." msgstr "L’environnement sélectionné n’est pas valide." -#: pkg/booking/admin.go:253 +#: pkg/booking/admin.go:254 msgid "Selected integration is not valid." msgstr "L’intégration sélectionnée n’est pas valide." -#: pkg/booking/admin.go:256 +#: pkg/booking/admin.go:257 msgid "The merchant key is not valid." msgstr "La clé marchand n’est pas valide." diff --git a/web/static/camper.css b/web/static/camper.css index 20ab1f0..3213629 100644 --- a/web/static/camper.css +++ b/web/static/camper.css @@ -263,6 +263,15 @@ body > nav a { align-items: center; } +body > footer { + border-top: 1px solid var(--camper--color--light-gray); + padding: .25em 3rem; +} + +body > footer p { + margin: 0; +} + main { padding: 2rem 3rem; } diff --git a/web/templates/admin/campsite/feature/form.gohtml b/web/templates/admin/campsite/feature/form.gohtml index 7c29ee3..b7dfb16 100644 --- a/web/templates/admin/campsite/feature/form.gohtml +++ b/web/templates/admin/campsite/feature/form.gohtml @@ -73,7 +73,7 @@ diff --git a/web/templates/admin/campsite/index.gohtml b/web/templates/admin/campsite/index.gohtml index 2867f00..a243e61 100644 --- a/web/templates/admin/campsite/index.gohtml +++ b/web/templates/admin/campsite/index.gohtml @@ -35,7 +35,7 @@ {{- end }} {{- end }} diff --git a/web/templates/admin/layout.gohtml b/web/templates/admin/layout.gohtml index 3d35476..8620756 100644 --- a/web/templates/admin/layout.gohtml +++ b/web/templates/admin/layout.gohtml @@ -9,12 +9,12 @@ {{ template "title" . }} — Camper - - + + - + {{ block "head" . }}{{ end }} @@ -97,5 +97,8 @@
{{- template "content" . }}
+
+

{{printf (gettext "Camper Version: %s") camperVersion }}

+
diff --git a/web/templates/admin/media/picker.gohtml b/web/templates/admin/media/picker.gohtml index 2fca516..933961e 100644 --- a/web/templates/admin/media/picker.gohtml +++ b/web/templates/admin/media/picker.gohtml @@ -33,7 +33,7 @@
diff --git a/web/templates/admin/media/upload.gohtml b/web/templates/admin/media/upload.gohtml index 1102aad..e9be911 100644 --- a/web/templates/admin/media/upload.gohtml +++ b/web/templates/admin/media/upload.gohtml @@ -28,7 +28,7 @@
{{- end }} diff --git a/web/templates/admin/season/calendar.gohtml b/web/templates/admin/season/calendar.gohtml index 265d84f..6390eed 100644 --- a/web/templates/admin/season/calendar.gohtml +++ b/web/templates/admin/season/calendar.gohtml @@ -62,7 +62,7 @@ {{ end }} diff --git a/web/templates/admin/services/form.gohtml b/web/templates/admin/services/form.gohtml index 7c93b38..dbade37 100644 --- a/web/templates/admin/services/form.gohtml +++ b/web/templates/admin/services/form.gohtml @@ -86,7 +86,7 @@ diff --git a/web/templates/public/layout.gohtml b/web/templates/public/layout.gohtml index db5fff2..b3bfc65 100644 --- a/web/templates/public/layout.gohtml +++ b/web/templates/public/layout.gohtml @@ -12,8 +12,8 @@ {{ template "title" . }} — {{( gettext "Campsite Montagut" )}} - - + + {{ range .LocalizedAlternates -}} {{ end }}