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.
This commit is contained in:
jordi fita mas 2023-10-06 22:02:59 +02:00
parent d5905a2277
commit ae29726fa2
7 changed files with 133 additions and 35 deletions

View File

@ -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,
)
}

View File

@ -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)
},

View File

@ -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 <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\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 "Lentorn"
@ -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"

View File

@ -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 <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\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"

View File

@ -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;
}

View File

@ -14,14 +14,7 @@
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.contactPage*/ -}}
<h2>{{( pgettext "Contact" "title" )}}</h2>
{{ with .PublicPage.CompanyAddress }}
<address>
{{ .Address }}<br>
{{ .PostalCode}} · {{ .City }} · {{ .Province }}<br>
<abbr>T</abbr> <a href="{{ .PhoneURL }}">{{ .Phone }}</a><br>
<a href="mailto:{{ .Email }}">{{ .Email }}</a>
</address>
{{- end }}
{{ template "companyAddress" .PublicPage.CompanyAddress }}
<div id="map"></div>
{{ if .CompanyGeography -}}

View File

@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
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*/ -}}
<!doctype html>
<html lang="{{ currentLocale }}">
<head>
@ -59,7 +59,38 @@
<main id="content">
{{- template "content" . }}
</main>
<footer>© {{( gettext "Campsite Montagut" )}} | 19842023</footer>
<footer>
<div>
<section>
<h2>{{( pgettext "Sections" "title" )}}</h2>
<ul>
<li><a href="/{{ currentLocale }}/">{{( pgettext "Home" "title" )}}</a></li>
<li><a href="/{{ currentLocale }}/services">{{( pgettext "Services" "title" )}}</a></li>
<li><a href="/{{ currentLocale }}/surroundings">{{( pgettext "Surroundings" "title" )}}</a></li>
<li><a href="/{{ currentLocale }}/contact">{{( pgettext "Contact" "title" )}}</a></li>
</ul>
</section>
{{ with .Menu -}}
{{ if .CampsiteTypes -}}
<section>
<h2>{{( pgettext "Campsites" "title" )}}</h2>
<ul>
{{ range .CampsiteTypes -}}
<li><a href="{{ .HRef }}">{{ .Label }}</a></li>
{{ end }}
</ul>
</section>
{{- end }}
{{- end }}
<section>
<h2>{{ .CompanyAddress.TradeName }}</h2>
{{ template "companyAddress" .CompanyAddress }}
</section>
</div>
<span>© {{( gettext "Campsite Montagut" )}} | 19842023</span>
</footer>
</body>
</html>
@ -67,6 +98,16 @@
<a rel="alternate" href="{{ .HRef }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ .Endonym }}</a>
{{- end }}
{{ define "companyAddress" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/template.address*/ -}}
<address>
{{ .Address }}<br>
{{ .PostalCode}} · {{ .City }} · {{ .Province }}<br>
<abbr>T</abbr> <a href="tel:{{ replaceAll .Phone " " "" }}">{{ .Phone }}</a><br>
<a href="mailto:{{ .Email }}">{{ .Email }}</a>
</address>
{{- end }}
{{ define "carouselStyle" -}}
<link rel="stylesheet" media="screen" href="/static/slick@1.8.1.css">
{{- end }}