From ae29726fa252a6e1d264b2373c623bef208ca177 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Fri, 6 Oct 2023 22:02:59 +0200 Subject: [PATCH] Add the footer site map I created a common template to show the company address in the footer and the contact page, and then i realized Go did not like to output my phone URL in the anchor without having the tel: schema in the template. I then removed that variable and now the URL is created with tel: and the phone number with its spaces removed. --- pkg/template/page.go | 3 -- pkg/template/render.go | 4 +++ po/ca.po | 30 +++++++++++------- po/es.po | 30 +++++++++++------- web/static/public.css | 47 +++++++++++++++++++++++++++++ web/templates/public/contact.gohtml | 9 +----- web/templates/public/layout.gohtml | 45 +++++++++++++++++++++++++-- 7 files changed, 133 insertions(+), 35 deletions(-) diff --git a/pkg/template/page.go b/pkg/template/page.go index 36e072e..161ddaf 100644 --- a/pkg/template/page.go +++ b/pkg/template/page.go @@ -105,7 +105,6 @@ type address struct { Province string City string Phone string - PhoneURL string Email string } @@ -117,7 +116,6 @@ func (addr *address) FillFromDatabase(ctx context.Context, conn *database.Conn, , province , city , phone::text - , 'tel:' || replace(phone::text, ' ', '') , email::text from company where company_id = $1 @@ -129,7 +127,6 @@ func (addr *address) FillFromDatabase(ctx context.Context, conn *database.Conn, &addr.Province, &addr.City, &addr.Phone, - &addr.PhoneURL, &addr.Email, ) } diff --git a/pkg/template/render.go b/pkg/template/render.go index ca645e0..83b6877 100644 --- a/pkg/template/render.go +++ b/pkg/template/render.go @@ -12,6 +12,7 @@ import ( "net/http" "net/url" "path" + "strings" "dev.tandem.ws/tandem/camper/pkg/auth" httplib "dev.tandem.ws/tandem/camper/pkg/http" @@ -72,6 +73,9 @@ func mustRenderLayout(w io.Writer, user *auth.User, company *auth.Company, templ "raw": func(s string) template.HTML { return template.HTML(s) }, + "replaceAll": func(s, old, new string) string { + return strings.ReplaceAll(s, old, new) + }, "humanizeBytes": func(bytes int64) string { return humanizeBytes(bytes) }, diff --git a/po/ca.po b/po/ca.po index a1eebf3..29ec247 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: 2023-10-06 18:57+0200\n" +"POT-Creation-Date: 2023-10-06 21:58+0200\n" "PO-Revision-Date: 2023-07-22 23:45+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -20,7 +20,7 @@ msgstr "" #: web/templates/public/services.gohtml:6 #: web/templates/public/services.gohtml:15 -#: web/templates/public/layout.gohtml:42 +#: web/templates/public/layout.gohtml:43 web/templates/public/layout.gohtml:69 #: web/templates/admin/services/index.gohtml:53 msgctxt "title" msgid "Services" @@ -30,7 +30,8 @@ msgstr "Serveis" msgid "The campsite offers many different services." msgstr "El càmping disposa de diversos serveis." -#: web/templates/public/home.gohtml:6 web/templates/public/layout.gohtml:29 +#: web/templates/public/home.gohtml:6 web/templates/public/layout.gohtml:30 +#: web/templates/public/layout.gohtml:68 msgctxt "title" msgid "Home" msgstr "Inici" @@ -51,7 +52,7 @@ msgstr "Els nostres serveis" #: web/templates/public/home.gohtml:34 #: web/templates/public/surroundings.gohtml:6 #: web/templates/public/surroundings.gohtml:10 -#: web/templates/public/layout.gohtml:43 +#: web/templates/public/layout.gohtml:44 web/templates/public/layout.gohtml:70 msgctxt "title" msgid "Surroundings" msgstr "L’entorn" @@ -153,8 +154,14 @@ msgstr "Caiac" msgid "There are several points where you can go by kayak, from sections of the Ter river as well as on the coast…." msgstr "Hi ha diversos punts on poder anar amb caiac, des de trams del riu Ter com també a la costa…." -#: web/templates/public/layout.gohtml:11 web/templates/public/layout.gohtml:24 -#: web/templates/public/layout.gohtml:61 +#: web/templates/public/contact.gohtml:6 web/templates/public/contact.gohtml:15 +#: web/templates/public/layout.gohtml:45 web/templates/public/layout.gohtml:71 +msgctxt "title" +msgid "Contact" +msgstr "Contacte" + +#: web/templates/public/layout.gohtml:11 web/templates/public/layout.gohtml:25 +#: web/templates/public/layout.gohtml:93 msgid "Campsite Montagut" msgstr "Càmping Montagut" @@ -162,7 +169,7 @@ msgstr "Càmping Montagut" msgid "Skip to main content" msgstr "Salta al contingut principal" -#: web/templates/public/layout.gohtml:33 +#: web/templates/public/layout.gohtml:34 web/templates/public/layout.gohtml:78 #: web/templates/admin/campsite/index.gohtml:6 #: web/templates/admin/campsite/index.gohtml:12 #: web/templates/admin/layout.gohtml:40 web/templates/admin/layout.gohtml:71 @@ -170,6 +177,11 @@ msgctxt "title" msgid "Campsites" msgstr "Allotjaments" +#: web/templates/public/layout.gohtml:66 +msgctxt "title" +msgid "Sections" +msgstr "Apartats" + #: web/templates/admin/carousel/form.gohtml:8 #: web/templates/admin/carousel/form.gohtml:25 msgctxt "title" @@ -1211,10 +1223,6 @@ msgstr "No podeu deixar el nom del fitxer en blanc." #~ msgid "Title" #~ msgstr "Títol" -#~ msgctxt "input" -#~ msgid "Content" -#~ msgstr "Contingut" - #~ msgctxt "title" #~ msgid "Pages" #~ msgstr "Pàgines" diff --git a/po/es.po b/po/es.po index 259bb15..a9154bc 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: 2023-10-06 18:57+0200\n" +"POT-Creation-Date: 2023-10-06 21:58+0200\n" "PO-Revision-Date: 2023-07-22 23:46+0200\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -20,7 +20,7 @@ msgstr "" #: web/templates/public/services.gohtml:6 #: web/templates/public/services.gohtml:15 -#: web/templates/public/layout.gohtml:42 +#: web/templates/public/layout.gohtml:43 web/templates/public/layout.gohtml:69 #: web/templates/admin/services/index.gohtml:53 msgctxt "title" msgid "Services" @@ -30,7 +30,8 @@ msgstr "Servicios" msgid "The campsite offers many different services." msgstr "El camping dispone de varios servicios." -#: web/templates/public/home.gohtml:6 web/templates/public/layout.gohtml:29 +#: web/templates/public/home.gohtml:6 web/templates/public/layout.gohtml:30 +#: web/templates/public/layout.gohtml:68 msgctxt "title" msgid "Home" msgstr "Inicio" @@ -51,7 +52,7 @@ msgstr "Nuestros servicios" #: web/templates/public/home.gohtml:34 #: web/templates/public/surroundings.gohtml:6 #: web/templates/public/surroundings.gohtml:10 -#: web/templates/public/layout.gohtml:43 +#: web/templates/public/layout.gohtml:44 web/templates/public/layout.gohtml:70 msgctxt "title" msgid "Surroundings" msgstr "El entorno" @@ -153,8 +154,14 @@ msgstr "Kayak" msgid "There are several points where you can go by kayak, from sections of the Ter river as well as on the coast…." msgstr "Hay diversos puntos dónde podéis ir en kayak, desde tramos del río Ter como también en la costa…." -#: web/templates/public/layout.gohtml:11 web/templates/public/layout.gohtml:24 -#: web/templates/public/layout.gohtml:61 +#: web/templates/public/contact.gohtml:6 web/templates/public/contact.gohtml:15 +#: web/templates/public/layout.gohtml:45 web/templates/public/layout.gohtml:71 +msgctxt "title" +msgid "Contact" +msgstr "Contacto" + +#: web/templates/public/layout.gohtml:11 web/templates/public/layout.gohtml:25 +#: web/templates/public/layout.gohtml:93 msgid "Campsite Montagut" msgstr "Camping Montagut" @@ -162,7 +169,7 @@ msgstr "Camping Montagut" msgid "Skip to main content" msgstr "Saltar al contenido principal" -#: web/templates/public/layout.gohtml:33 +#: web/templates/public/layout.gohtml:34 web/templates/public/layout.gohtml:78 #: web/templates/admin/campsite/index.gohtml:6 #: web/templates/admin/campsite/index.gohtml:12 #: web/templates/admin/layout.gohtml:40 web/templates/admin/layout.gohtml:71 @@ -170,6 +177,11 @@ msgctxt "title" msgid "Campsites" msgstr "Alojamientos" +#: web/templates/public/layout.gohtml:66 +msgctxt "title" +msgid "Sections" +msgstr "Apartados" + #: web/templates/admin/carousel/form.gohtml:8 #: web/templates/admin/carousel/form.gohtml:25 msgctxt "title" @@ -1211,10 +1223,6 @@ msgstr "No podéis dejar el nombre del archivo en blanco." #~ msgid "Title" #~ msgstr "Título" -#~ msgctxt "input" -#~ msgid "Content" -#~ msgstr "Contenido" - #~ msgctxt "title" #~ msgid "Pages" #~ msgstr "Páginas" diff --git a/web/static/public.css b/web/static/public.css index ef94e64..e7c832a 100644 --- a/web/static/public.css +++ b/web/static/public.css @@ -149,6 +149,10 @@ a { text-decoration: none; } +address { + font-style: normal; +} + body > a[href="#content"], .sr-only { border: 0; clip: rect(1px, 1px, 1px, 1px); @@ -663,7 +667,50 @@ dt { } footer { + display: flex; + flex-direction: column; + gap: 1rem; +} + +footer div { + display: flex; + justify-content: space-between; + padding: 5rem 0; + margin: 0 2.5rem; + border-top: 3px solid black; + border-bottom: 3px solid black; +} + +footer section { + width: 25%; +} + +footer h2 { + font-size: 2.4rem; + margin-bottom: 2rem; + border-bottom: 1px solid black; +} + +footer ul { + list-style: none; + padding: 0; +} + +footer li a::before { + font-size: 1.25em; + content: "→"; + display: inline-block; + margin-right: .5em; + transition: transform .5s ease; +} + +footer li a:hover::before { + transform: translateX(.6rem); +} + +footer span { font-size: 1.5rem; text-align: center; padding: 2.5rem; + display: block; } diff --git a/web/templates/public/contact.gohtml b/web/templates/public/contact.gohtml index 01fdee6..92907ce 100644 --- a/web/templates/public/contact.gohtml +++ b/web/templates/public/contact.gohtml @@ -14,14 +14,7 @@ {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.contactPage*/ -}}

{{( pgettext "Contact" "title" )}}

- {{ with .PublicPage.CompanyAddress }} -
- {{ .Address }}
- {{ .PostalCode}} · {{ .City }} · {{ .Province }}
- T {{ .Phone }}
- {{ .Email }} -
- {{- end }} + {{ template "companyAddress" .PublicPage.CompanyAddress }}
{{ if .CompanyGeography -}} diff --git a/web/templates/public/layout.gohtml b/web/templates/public/layout.gohtml index d643d8b..19ad0e0 100644 --- a/web/templates/public/layout.gohtml +++ b/web/templates/public/layout.gohtml @@ -2,7 +2,7 @@ SPDX-FileCopyrightText: 2023 jordi fita mas SPDX-License-Identifier: AGPL-3.0-only --> -{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.PublicPage*/ -}} +{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/template.PublicPage*/ -}} @@ -59,7 +59,38 @@
{{- template "content" . }}
-
© {{( gettext "Campsite Montagut" )}} | 1984–2023
+ @@ -67,6 +98,16 @@ {{ .Endonym }} {{- end }} +{{ define "companyAddress" -}} + {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/template.address*/ -}} +
+ {{ .Address }}
+ {{ .PostalCode}} · {{ .City }} · {{ .Province }}
+ T {{ .Phone }}
+ {{ .Email }} +
+{{- end }} + {{ define "carouselStyle" -}} {{- end }}