Compare commits

..

2 Commits

Author SHA1 Message Date
jordi fita mas 18b38f593c Add the application’s version on the footer
This is mostly to reassure people that we are running the same version
as published on numerus.cat.  Or at least, try.

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
2024-01-19 20:03:04 +01:00
jordi fita mas 22ee6343e2 Use errors.Is to compare ErrServerClosed in main 2024-01-19 19:44:11 +01:00
8 changed files with 96 additions and 83 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"errors"
"log"
"net/http"
"os"
@ -29,7 +30,7 @@ func main() {
go func() {
log.Printf("INFO - listening on %s\n", srv.Addr)
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
log.Fatalf("http server: %v", err)
}
}()

1
debian/rules vendored
View File

@ -4,6 +4,7 @@
dh $@ --builddirectory=_build --buildsystem=golang --with=golang
execute_before_dh_auto_build:
printf 'package pkg; const Version = "%s"' "$(DEB_UPSTREAM_VERSION)" > pkg/build.go
make
execute_after_dh_auto_test:

3
pkg/build.go Normal file
View File

@ -0,0 +1,3 @@
package pkg
const Version = "1.1~git"

View File

@ -96,6 +96,9 @@ func mustRenderTemplate(wr io.Writer, r *http.Request, layout string, filename s
"slugify": func(s string) string {
return slugify(s)
},
"numerusVersion": func() string {
return Version
},
})
if _, err := t.ParseFiles(templateFile(filename), templateFile(layout), templateFile("form.gohtml")); err != nil {
panic(err)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-11-06 13:50+0100\n"
"POT-Creation-Date: 2024-01-19 19:57+0100\n"
"PO-Revision-Date: 2023-01-18 17:08+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -288,26 +288,6 @@ msgctxt "title"
msgid "Edit Invoice “%s”"
msgstr "Edició de la factura «%s»"
#: web/template/home.gohtml:9
msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
msgstr "Si vols accedir al teu usuari només has d'anar a %sla pàgina dentrada%s i apuntar les teves credencials al seu lloc."
#: web/template/home.gohtml:12
msgid "manager"
msgstr "gestor"
#: web/template/home.gohtml:16
msgid "Tool to simplify management for small business and freelancers"
msgstr "Eina per simplificar la gestió dautònoms i petites empreses."
#: web/template/home.gohtml:19
msgid "Reduce management time, take control of your balance."
msgstr "Redueix el temps de gestió, tingues controlats els teus números."
#: web/template/home.gohtml:20
msgid "application"
msgstr "aplicació"
#: web/template/form.gohtml:36
msgctxt "input"
msgid "(Max. %s)"
@ -334,32 +314,27 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/dashboard.gohtml:29
msgctxt "term"
msgid "Sales"
msgstr "Vendes"
#: web/template/dashboard.gohtml:33
#: web/template/dashboard.gohtml:31
msgctxt "term"
msgid "Income"
msgstr "Ingressos"
#: web/template/dashboard.gohtml:37
#: web/template/dashboard.gohtml:35
msgctxt "term"
msgid "Expenses"
msgstr "Despeses"
#: web/template/dashboard.gohtml:41
#: web/template/dashboard.gohtml:39
msgctxt "term"
msgid "VAT"
msgstr "IVA"
#: web/template/dashboard.gohtml:45
#: web/template/dashboard.gohtml:43
msgctxt "term"
msgid "IRPF"
msgstr "IRPF"
#: web/template/dashboard.gohtml:49
#: web/template/dashboard.gohtml:47
msgctxt "term"
msgid "Net Income"
msgstr "Ingressos nets"
@ -439,56 +414,60 @@ msgctxt "title"
msgid "Edit Quotation “%s”"
msgstr "Edició del pressupost «%s»"
#: web/template/app.gohtml:23
#: web/template/app.gohtml:24
msgctxt "menu"
msgid "Account"
msgstr "Compte"
#: web/template/app.gohtml:29
#: web/template/app.gohtml:30
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuració fiscal"
#: web/template/app.gohtml:35
#: web/template/app.gohtml:36
msgctxt "menu"
msgid "Switch Company"
msgstr "Canvi dempresa"
#: web/template/app.gohtml:43
#: web/template/app.gohtml:44
msgctxt "action"
msgid "Logout"
msgstr "Surt"
#: web/template/app.gohtml:52
#: web/template/app.gohtml:53
msgctxt "nav"
msgid "Dashboard"
msgstr "Tauler"
#: web/template/app.gohtml:53
#: web/template/app.gohtml:54
msgctxt "nav"
msgid "Quotations"
msgstr "Pressuposts"
#: web/template/app.gohtml:54
#: web/template/app.gohtml:55
msgctxt "nav"
msgid "Invoices"
msgstr "Factures"
#: web/template/app.gohtml:55
#: web/template/app.gohtml:56
msgctxt "nav"
msgid "Expenses"
msgstr "Despeses"
#: web/template/app.gohtml:56
#: web/template/app.gohtml:57
msgctxt "nav"
msgid "Products"
msgstr "Productes"
#: web/template/app.gohtml:57
#: web/template/app.gohtml:58
msgctxt "nav"
msgid "Contacts"
msgstr "Contactes"
#: web/template/app.gohtml:66
msgid "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s"
msgstr "<a href=\"https://numerus.cat/\">Numerus</a> versió: %s"
#: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11
#: web/template/contacts/new.gohtml:19
msgctxt "title"
@ -1374,6 +1353,25 @@ msgctxt "input"
msgid "Holded Excel file"
msgstr "Fitxer Excel del Holded"
#~ msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
#~ msgstr "Si vols accedir al teu usuari només has d'anar a %sla pàgina dentrada%s i apuntar les teves credencials al seu lloc."
#~ msgid "manager"
#~ msgstr "gestor"
#~ msgid "Tool to simplify management for small business and freelancers"
#~ msgstr "Eina per simplificar la gestió dautònoms i petites empreses."
#~ msgid "Reduce management time, take control of your balance."
#~ msgstr "Redueix el temps de gestió, tingues controlats els teus números."
#~ msgid "application"
#~ msgstr "aplicació"
#~ msgctxt "term"
#~ msgid "Sales"
#~ msgstr "Vendes"
#~ msgctxt "title"
#~ msgid "Switch Company"
#~ msgstr "Canvi dempresa"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-11-06 13:50+0100\n"
"POT-Creation-Date: 2024-01-19 19:57+0100\n"
"PO-Revision-Date: 2023-01-18 17:45+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
@ -288,26 +288,6 @@ msgctxt "title"
msgid "Edit Invoice “%s”"
msgstr "Edición de la factura «%s»"
#: web/template/home.gohtml:9
msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
msgstr "Si quieres acceder a tu usuario solo tienes que ir a %sla página de entrada% y anotar tus credenciales a su sitio."
#: web/template/home.gohtml:12
msgid "manager"
msgstr "gestor"
#: web/template/home.gohtml:16
msgid "Tool to simplify management for small business and freelancers"
msgstr "Herramienta para simplificar la gestión de autónomos y pequeñas empresas."
#: web/template/home.gohtml:19
msgid "Reduce management time, take control of your balance."
msgstr "Reduce el tiempo de gestión, ten controlados tus números."
#: web/template/home.gohtml:20
msgid "application"
msgstr "aplicación"
#: web/template/form.gohtml:36
msgctxt "input"
msgid "(Max. %s)"
@ -334,32 +314,27 @@ msgctxt "title"
msgid "Dashboard"
msgstr "Panel"
#: web/template/dashboard.gohtml:29
msgctxt "term"
msgid "Sales"
msgstr "Ventas"
#: web/template/dashboard.gohtml:33
#: web/template/dashboard.gohtml:31
msgctxt "term"
msgid "Income"
msgstr "Ingresos"
#: web/template/dashboard.gohtml:37
#: web/template/dashboard.gohtml:35
msgctxt "term"
msgid "Expenses"
msgstr "Gastos"
#: web/template/dashboard.gohtml:41
#: web/template/dashboard.gohtml:39
msgctxt "term"
msgid "VAT"
msgstr "IVA"
#: web/template/dashboard.gohtml:45
#: web/template/dashboard.gohtml:43
msgctxt "term"
msgid "IRPF"
msgstr "IRPF"
#: web/template/dashboard.gohtml:49
#: web/template/dashboard.gohtml:47
msgctxt "term"
msgid "Net Income"
msgstr "Ingresos netos"
@ -439,56 +414,60 @@ msgctxt "title"
msgid "Edit Quotation “%s”"
msgstr "Edición del presupuesto «%s»"
#: web/template/app.gohtml:23
#: web/template/app.gohtml:24
msgctxt "menu"
msgid "Account"
msgstr "Cuenta"
#: web/template/app.gohtml:29
#: web/template/app.gohtml:30
msgctxt "menu"
msgid "Tax Details"
msgstr "Configuración fiscal"
#: web/template/app.gohtml:35
#: web/template/app.gohtml:36
msgctxt "menu"
msgid "Switch Company"
msgstr "Cambio de empresa"
#: web/template/app.gohtml:43
#: web/template/app.gohtml:44
msgctxt "action"
msgid "Logout"
msgstr "Salir"
#: web/template/app.gohtml:52
#: web/template/app.gohtml:53
msgctxt "nav"
msgid "Dashboard"
msgstr "Panel"
#: web/template/app.gohtml:53
#: web/template/app.gohtml:54
msgctxt "nav"
msgid "Quotations"
msgstr "Presupuestos"
#: web/template/app.gohtml:54
#: web/template/app.gohtml:55
msgctxt "nav"
msgid "Invoices"
msgstr "Facturas"
#: web/template/app.gohtml:55
#: web/template/app.gohtml:56
msgctxt "nav"
msgid "Expenses"
msgstr "Gastos"
#: web/template/app.gohtml:56
#: web/template/app.gohtml:57
msgctxt "nav"
msgid "Products"
msgstr "Productos"
#: web/template/app.gohtml:57
#: web/template/app.gohtml:58
msgctxt "nav"
msgid "Contacts"
msgstr "Contactos"
#: web/template/app.gohtml:66
msgid "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s"
msgstr "<a href=\"https://numerus.cat/\">Numerus</a> versión: %s"
#: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11
#: web/template/contacts/new.gohtml:19
msgctxt "title"
@ -1374,6 +1353,25 @@ msgctxt "input"
msgid "Holded Excel file"
msgstr "Archivo Excel de Holded"
#~ msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
#~ msgstr "Si quieres acceder a tu usuario solo tienes que ir a %sla página de entrada% y anotar tus credenciales a su sitio."
#~ msgid "manager"
#~ msgstr "gestor"
#~ msgid "Tool to simplify management for small business and freelancers"
#~ msgstr "Herramienta para simplificar la gestión de autónomos y pequeñas empresas."
#~ msgid "Reduce management time, take control of your balance."
#~ msgstr "Reduce el tiempo de gestión, ten controlados tus números."
#~ msgid "application"
#~ msgstr "aplicación"
#~ msgctxt "term"
#~ msgid "Sales"
#~ msgstr "Ventas"
#~ msgctxt "title"
#~ msgid "Switch Company"
#~ msgstr "Cambio de empresa"

View File

@ -314,6 +314,12 @@ main {
padding: 2rem 3rem;
}
body > footer {
border-top: 1px solid var(--numerus--color--light-gray);
font-size: 75%;
padding: .25em 3rem;
}
.input {
margin-top: 2rem;
flex: 1;

View File

@ -62,6 +62,9 @@
{{- template "breadcrumbs" . }}
{{- template "content" . }}
</main>
<footer>
<p>{{printf ( gettext "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s") numerusVersion | unsafe}}</p>
</footer>
</body>
<div x-data="snackbar">
<div x-show="show"