diff --git a/pkg/login.go b/pkg/login.go index 00ec17e..4d72baf 100644 --- a/pkg/login.go +++ b/pkg/login.go @@ -80,6 +80,10 @@ func (form *loginForm) Validate() bool { return validator.AllOK() } +func (form *loginForm) mustRender(w http.ResponseWriter, r *http.Request) { + mustRenderTemplate(w, r, "login.gohtml", "login.gohtml", form) +} + func GetLoginForm(w http.ResponseWriter, r *http.Request, demo bool) { user := getUser(r) if user.LoggedIn { @@ -89,7 +93,7 @@ func GetLoginForm(w http.ResponseWriter, r *http.Request, demo bool) { locale := getLocale(r) form := newLoginForm(demo, locale) w.WriteHeader(http.StatusOK) - mustRenderLoginForm(w, r, form) + form.mustRender(w, r) } func HandleLoginForm(w http.ResponseWriter, r *http.Request, demo bool) { @@ -117,11 +121,7 @@ func HandleLoginForm(w http.ResponseWriter, r *http.Request, demo bool) { } else { w.WriteHeader(http.StatusUnprocessableEntity) } - mustRenderLoginForm(w, r, form) -} - -func mustRenderLoginForm(w http.ResponseWriter, r *http.Request, form *loginForm) { - mustRenderWebTemplate(w, r, "login.gohtml", form) + form.mustRender(w, r) } func HandleLogout(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { diff --git a/pkg/router.go b/pkg/router.go index c9b6413..66c1b98 100644 --- a/pkg/router.go +++ b/pkg/router.go @@ -105,29 +105,17 @@ func NewRouter(db *Db, demo bool) http.Handler { router.PUT("/company/:slug/*rest", companyHandler) router.DELETE("/company/:slug/*rest", companyHandler) - router.GET("/legal", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - mustRenderWebTemplate(w, r, "legal.gohtml", nil) - }) - - router.GET("/privacy", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - mustRenderWebTemplate(w, r, "privacy.gohtml", nil) - }) - - router.GET("/cookies", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - mustRenderWebTemplate(w, r, "cookies.gohtml", nil) - }) - router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { user := getUser(r) - if user.LoggedIn { - conn := getConn(r) - company := &Company{ - Slug: conn.MustGetText(r.Context(), "", "select slug::text from company order by company_id limit 1"), - } - http.Redirect(w, r, companyURI(company, "/"), http.StatusFound) - } else { - mustRenderWebTemplate(w, r, "home.gohtml", nil) + if !user.LoggedIn { + http.Redirect(w, r, "/login", http.StatusSeeOther) + return } + conn := getConn(r) + company := &Company{ + Slug: conn.MustGetText(r.Context(), "", "select slug::text from company order by company_id limit 1"), + } + http.Redirect(w, r, companyURI(company, "/"), http.StatusFound) }) var handler http.Handler = router diff --git a/pkg/template.go b/pkg/template.go index 9051bea..c807a36 100644 --- a/pkg/template.go +++ b/pkg/template.go @@ -156,10 +156,6 @@ func mustRenderStandaloneTemplateFragment(w io.Writer, r *http.Request, filename mustRenderTemplateFragment(w, r, "standalone.gohtml", filename, fragment, data) } -func mustRenderWebTemplate(w io.Writer, r *http.Request, filename string, data interface{}) { - mustRenderTemplate(w, r, "web.gohtml", filename, data) -} - func humanizeBytes(s int64, base float64, sizes []string) string { if s < 10 { return fmt.Sprintf("%d B", s) diff --git a/web/static/numerus.css b/web/static/numerus.css index 798cf8f..e328d72 100644 --- a/web/static/numerus.css +++ b/web/static/numerus.css @@ -1119,6 +1119,42 @@ div[x-data="snackbar"] div[role="alert"].enter.end, div[x-data="snackbar"] div[r vector-effect: non-scaling-stroke; } +/* login */ + +#login { + margin: 3rem; + background-color: var(--numerus--header--background-color); +} + +#login > header { + border-bottom: 1px solid var(--numerus--color--black); +} + +#login h1 { + padding-bottom: .9375em; +} + +#login article { + padding: 1.25em; + min-height: 70vh; +} + +#login h2 { + margin-bottom: 1em; +} + +#login button { + min-width: 26rem; + background-color: var(--numerus--color--black); + border: 2px solid var(--numerus--color--black); + text-transform: uppercase; + display: inline-block; + text-align: center; + padding: 1.55rem; + cursor: pointer; + color: var(--numerus--color--white); +} + /* Remix Icon */ @font-face { @@ -10290,450 +10326,3 @@ div[x-data="snackbar"] div[role="alert"].enter.end, div[x-data="snackbar"] div[r .ri-zzz-line:before { content: '\f2df'; } - - -#login { - padding: 1.25em; - min-height: 70vh; -} - -#login h2 { - margin-bottom: 1em; -} - -#login button { - min-width: 26rem; - background-color: var(--numerus--color--black); - border: 2px solid var(--numerus--color--black); - text-transform: uppercase; - display: inline-block; - text-align: center; - padding: 1.55rem; - cursor: pointer; - color: var(--numerus--color--white); -} - -/* web */ - -/* web mobile */ - -@media screen and (max-width: 600px) { - - header, header nav a { - padding: 0; - } - - .web > header { - flex-direction: column; - } - - .web nav { - width: 100%; - border-top: solid 1px var(--numerus--color--black); - } - - .web nav ul { - margin: 0; - justify-content: space-around; - } - - .web nav ul li { - padding: 6rem 0; - } - -} - - -/* web tablet */ - -@media screen and (max-width: 992px) { - - .web nav ul { - gap: 2rem; - margin: 0 0 0 5rem; - } - - .mondrian2 { - font-size: calc(16px + 3vw); - } - .mondrian4 { - font-size: calc(16px + 3vw); - } - .mondrian10 { - font-size: calc(16px + .3vw); - } - .mondrian14 { - font-size: 1.4rem; - } - - .web nav ul li { - padding: 0; - } - - -} - - -/* web desktop */ - -.web { - margin: 3rem; - background-color: var(--numerus--header--background-color); -} - -.web h1 { - padding-bottom: .9375em; -} - -.web > header { - display: flex; - justify-content: space-between; - align-items: start; - border-bottom: 1px solid var(--numerus--color--black); -} - -.web > footer { - border-top: 1px solid var(--numerus--color--black); - margin: 0 0 5rem 0; - padding: 5rem 0 0 0; - display: flex; - justify-content: space-between; - align-items: flex-start; -} - -.web nav ul { - list-style: none; - padding: 0; - text-transform: uppercase; - display: flex; - gap: 5rem; -} - -.web nav ul li { - padding: 0; -} - -.web footer nav ul { - justify-content: center; - font-size: 83.3333%; -} - -.web nav a { - color: var(--numerus--font-family); - text-decoration: none; -} - -.web .legal { - margin: 5rem 0; -} - -.web .legal h2 { - margin: .5em 0 1.5em 0; -} - -.web .legal address, -.web .legal h3, -.web .legal h4, -.web .legal dl { - margin: 1.5789em 0; -} - -.web .legal h2 { - counter-reset: section; -} - -.web .legal h3 { - text-transform: uppercase; - counter-reset: subsection; -} - -.web .legal h3::before { - counter-increment: section; - content: counter(section) ". "; -} - -.web .legal h4::before { - counter-increment: subsection; - content: counter(section) "." counter(subsection) ". "; -} - -.web .legal p { - line-height: 1.25; -} - -.web .legal p + p { - text-indent: 1em; -} - -.web .legal dl { - padding-inline-start: 40px; -} - -.web .legal dt { - font-weight: bold; -} - -.web .legal dt:not(:first-of-type) { - margin-top: 1.5789em; -} - -/* css grid */ - -.mondrian { -display: grid; -grid-template-columns: repeat(6, 1fr); -grid-template-rows: repeat(5, 1fr); -grid-column-gap: 0px; -grid-row-gap: 0px; -} - -.mondrian-element { - height: 15rem; -} - -.mondrian1 { - grid-area: 1 / 1 / 2 / 5; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian2 { - grid-area: 1 / 5 / 2 / 7; - background: var(--numerus--color--yellow); - font-size: calc(16px + 5vw); - display: grid; - align-content: center; - justify-content: start; - padding: 1rem; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian3 { - grid-area: 2 / 1 / 3 / 2; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian4 { - grid-area: 2 / 2 / 3 / 4; - background: var(--numerus--color--green); - font-size: calc(16px + 5vw); - display: grid; - align-content: center; - justify-content: start; - padding: 1rem; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian5 { - grid-area: 2 / 4 / 3 / 6; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian6 { - grid-area: 2 / 6 / 3 / 7; - background: white; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian7 { - grid-area: 3 / 1 / 4 / 3; - background: white; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian8 { - grid-area: 3 / 3 / 4 / 7; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian9 { - grid-area: 4 / 1 / 5 / 2; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian10 { - grid-area: 4 / 2 / 6 / 4; - height: 30rem; - border-bottom: 1px solid var(--numerus--color--black); - background: var(--numerus--color--black); - color: white; - padding: 1rem; - font-size: calc(16px + .7vw); -} -.mondrian11 { - grid-area: 4 / 4 / 5 / 7; - border-bottom: 1px solid var(--numerus--color--black); -} -.mondrian12 { - grid-area: 5 / 1 / 6 / 2; -} -.mondrian13 { - grid-area: 5 / 4 / 6 / 5; - display: flex; - justify-content: center; - align-content: center; -} -.mondrian13 svg { -} -.mondrian14 { - grid-area: 5 / 5 / 6 / 6; - background: var(--numerus--color--red); - padding: 1rem; - font-size: calc(16px + 0.2vw); -} -.mondrian15 { - grid-area: 5 / 6 / 6 / 7; -} - -.description { -display: grid; -grid-template-columns: repeat(6, 1fr); -grid-template-rows: repeat(4, 1fr); -grid-column-gap: 0px; -grid-row-gap: 0px; -margin: 5rem 0; -} - -.description-text { - grid-area: 1 / 1 / 4 / 3; -} - -.description-text p { - padding: 0 0 2rem 0; - padding: 1rem; -} - -.description-items { - grid-area: 2 / 4 / 4 / 6; -} - -.icon-list { - display: flex; - gap: 10px; - padding: 5px 0; -} - -.icon-list svg { - width: 24px; -} - -.description-progress { - grid-area: 4 / 4 / 5 / 6; - margin: 5rem 0; - padding: 0 0 0 35px; - font-size: 1.3rem; -} - -.open { - display: grid; - grid-template-columns: repeat(6, 1fr); - grid-template-rows: repeat(4, 1fr); - grid-column-gap: 0px; - grid-row-gap: 0px; - border-top: 1px solid var(--numerus--color--black); -} - -.deco_1 { - grid-area: 1 / 1 / 2 / 2; - background: white; -} -.license { - grid-area: 2 / 4 / 4 / 6; -} -.download { - grid-area: 3 / 2 / 4 / 3; -} -.download button { - margin: 5rem 0; - background: var(--numerus--color--yellow); - border: var(--numerus--color--yellow); - width: 100%; - font-size: calc(16px + 1vw); - color: var(--numerus--color--black); - display: flex; - gap: 2.5rem; -} - -.download a { - text-decoration: none; -} - -.download svg { - width: 30px; -} - -.deco_2 { - grid-area: 4 / 5 / 5 / 6; - background: white; -} - -.price { - display: grid; - grid-template-columns: repeat(6, 1fr); - grid-template-rows: repeat(3, 1fr); - grid-column-gap: 0px; - grid-row-gap: 0px; - border-top: 1px solid var(--numerus--color--black); - padding: 5rem 0; -} - -.price_description { - grid-area: 1 / 1 / 3 / 3; -} - -.price_description p { - margin: 0 0 2rem 0; -} - -.price_cta { - grid-area: 2 / 4 / 4 / 6; -} - -.price-detail { - display: flex; - flex-direction: row; - gap: 10px; - align-items: baseline; -} - -.price-detail h3 { - font-size: 4rem; -} - -.price_cta p { - margin: 2rem 0; -} - - -/* home mobile */ - -@media screen and (max-width: 600px) { - - .mondrian { - display: flex; - flex-direction: column; - } - - .mondrian-element.mondrian1, .mondrian-element.mondrian3, .mondrian-element.mondrian5, .mondrian-element.mondrian6, .mondrian-element.mondrian7, .mondrian-element.mondrian8, .mondrian-element.mondrian9, .mondrian-element.mondrian11, .mondrian-element.mondrian12, .mondrian-element.mondrian13, .mondrian-element.mondrian15 { - display: none; - } - - .description { - display: flex; - flex-direction: column; - gap: 30px; - margin-top: 60px; - } - .open { - display: flex; - flex-direction: column; - } - - .price { - display: flex; - flex-direction: column; - gap: 30px; - margin: 60px 0; - border-top: 1px solid; - padding-top: 30px; - } - - footer { - flex-direction: column; - gap: 30px; - } - - footer nav ul { - padding-top: 30px !important; - } -} diff --git a/web/template/cookies.gohtml b/web/template/cookies.gohtml deleted file mode 100644 index 41c150f..0000000 --- a/web/template/cookies.gohtml +++ /dev/null @@ -1,167 +0,0 @@ -{{ define "title" -}} - {{( pgettext "Cookies Policy" "title" )}} -{{- end }} - -{{ define "content" -}} - -{{- end }} diff --git a/web/template/home.gohtml b/web/template/home.gohtml deleted file mode 100644 index ebc34b9..0000000 --- a/web/template/home.gohtml +++ /dev/null @@ -1,102 +0,0 @@ -{{ define "title" -}} - {{( pgettext "Home" "title" )}} -{{- end }} - -{{ define "content" -}} -
-
-
- autònoms -
-
-
- gestió -
-
-
-
-
-
-
- PRESSUPOSTOS
- FACTURES
- DESPESES
- IMPOSTOS
- SERVEIS/PRODUCTES
- CONTACTES
-
-
-
-
- -
-
-

Eina per simplificar la gestió, que prou feina tens amb lo teu.

-
-
-
- -
-
-

Si estàs en règim d'autònom/a ja saps el que costa portar al dia la facturació.

- -

Tips de provar diferents aplicacions i que cap s'ajustés a les nostres necessitats, vam decidir fer la nostra pròpia eina: numerus.

- -

L'hem estat provant un temps i creiem que és hora de compartir-la.

- -

Creiem que per a una petita empresa, cooperativa o una associació també pot ajudar a gestionar els números de l'entitat.

-
-
-
usuari/a administrador/a
-
usuari/a gestor/a
-
usuari/a comptable
-
creació de tipus d’impostos
-
gràfiques de progrés i comparació
-
etiquetes per classificar
-
filtres avançats
-
idiomes: cat esp eng
-
creació de productes/serveis com a base
-
-
- estem treballant amb:
- control d’estoc
- tiquets (factura simplificada)
- alta usuaris/es i cobrament recurrent
-
-
- -
-
-
-
- -
-

numerus és programari lliure distribuït sota La Llicència Pública General Affero (AGPL), això vol dir que t’ho pots descarregar, instal·lar al teu servidor(*), modificar i compartir el que has fet(**).

- -

*_ servidor mínim: 1 GB RAM, 1/2 vCore, 5 GB SSD NVMe.
- **_ sempre que respectis els mateixos valors i ho comparteixis amb la mateixa llicència.

-
-
- -
-
-
- -
-
-

Si no saps com instal·lar numerus en un servidor, pots registrar-te amb nosaltres.

- -

Obtindràs un accés privat i encriptat al teu tauler on gestionar tota l'aplicació.

- -

Nosaltres et cobrarem el que costa un servidor dedicat a clouding.io per allotjar Numerus + la gestió i manteniment de l'aplicació + impostos.

- -

I de pas ens ajudes a mantenir i millorar el que hem fet i t'és útil :)

-
-
-

6,00 €/mes

(sense impostos)
-

7,26 €/mes

(amb impostos)
-

Al crear un usuari, pots cancel·lar la teva subscripció en qualsevol moment. Es cobrarà fins al mes actual.

-

Escriu-nos a hola@tandem.blog i donem d'alta el teu perfil

-
-
-{{- end }} diff --git a/web/template/legal.gohtml b/web/template/legal.gohtml deleted file mode 100644 index dc93938..0000000 --- a/web/template/legal.gohtml +++ /dev/null @@ -1,189 +0,0 @@ -{{ define "title" -}} - {{( pgettext "Legal Disclaimer" "title" )}} -{{- end }} - -{{ define "content" -}} - -{{- end }} diff --git a/web/template/login.gohtml b/web/template/login.gohtml index b2e376f..2975d3e 100644 --- a/web/template/login.gohtml +++ b/web/template/login.gohtml @@ -1,22 +1,34 @@ -{{ define "title" -}} - {{( pgettext "Login" "title" )}} -{{- end }} + + + + + + + + {{( pgettext "Login" "title" )}} — Numerus + + + +
+

Numerus

+
-{{ define "content" }} - {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.loginForm*/ -}} - {{ if .Errors -}} - - {{- end }} -
-

{{( pgettext "Login" "title" )}}

-
- {{ template "input-field" .Email }} - {{ template "input-field" .Password }} - -
-
-{{- end }} +{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.loginForm*/ -}} +
+

{{( pgettext "Login" "title" )}}

+
+ {{ if .Errors -}} + + {{- end }} + {{ template "input-field" .Email }} + {{ template "input-field" .Password }} + +
+
+ + + diff --git a/web/template/privacy.gohtml b/web/template/privacy.gohtml deleted file mode 100644 index f179e76..0000000 --- a/web/template/privacy.gohtml +++ /dev/null @@ -1,224 +0,0 @@ -{{ define "title" -}} - {{( pgettext "Privacy Policy" "title" )}} -{{- end }} - -{{ define "content" -}} - -{{- end }} diff --git a/web/template/web.gohtml b/web/template/web.gohtml deleted file mode 100644 index b9cc7c4..0000000 --- a/web/template/web.gohtml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - {{ template "title" . }} — Numerus - - - - -
-

Numerus

- -
- -{{- template "content" . }} - - - - -