camper/web/templates/public/contact.gohtml

63 lines
2.1 KiB
Plaintext
Raw Normal View History

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Contact" "title" )}}
{{- end }}
{{ define "head" -}}
<link rel="stylesheet" href="/static/leaflet@1.9.4/leaflet.css">
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.contactPage*/ -}}
2023-12-13 22:23:28 +00:00
<div class="contact-page">
<div class="contact-details">
<h2>{{( pgettext "Contact" "title" )}}</h2>
{{ template "companyAddress" .PublicPage.CompanyAddress }}
2023-12-20 12:02:56 +00:00
<p>GPS: 42º 14 43,86 / 2º 35 58,26</p>
2023-12-13 22:23:28 +00:00
</div>
<div id="map"></div>
2023-12-13 22:23:28 +00:00
</div>
{{ if .CompanyGeography -}}
<script src="/static/leaflet@1.9.4/leaflet.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var container = document.getElementById("map");
2023-12-13 22:23:28 +00:00
container.style.height = '600px';
var map = L.map(container).setView(['{{ .CompanyGeography.Lat }}', '{{ .CompanyGeography.Lng }}'], '9');
L
.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, © <a href="https://carto.com/attributions">CARTO</a>'
})
.addTo(map)
;
map.scrollWheelZoom.disable();
var content =
{{- with .PublicPage.CompanyAddress -}}
'{{ .Address }}<br>{{ .City }} - {{ .PostalCode }}<br>{{ .Province }}'
{{- end -}}
;
L
.marker(['{{ .CompanyGeography.Lat }}', '{{ .CompanyGeography.Lng }}'])
.addTo(map)
.bindPopup(content)
;
var observer = ResizeObserver && new ResizeObserver(function () {
map.invalidateSize(true);
});
observer && observer.observe(container);
});
</script>
{{- end }}
{{- end }}