Add the contact page, containing a map with the company location
I was not sure whether to use PostGIS to store the GPS location of the
company, as i am sure i will only use that point just to show the map.
However, just in case, it is not a big deal.
There is no way to change that from the administration pages for now,
because of time constraints, and it is very unlikely that they will
change the campgrounds’ location in the near future.
The location is in a separate table because i did not want to have to
change every test file, to be honest, but this also makes the map
“optional” without the need for NULL values.
I added the contact address to every public page because the new design
adds it to the footer, so i will be needing it everywhere, just like the
menu.
2023-10-06 19:21:00 +00:00
|
|
|
|
<!--
|
|
|
|
|
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>
|
|
|
|
|
|
Add the contact page, containing a map with the company location
I was not sure whether to use PostGIS to store the GPS location of the
company, as i am sure i will only use that point just to show the map.
However, just in case, it is not a big deal.
There is no way to change that from the administration pages for now,
because of time constraints, and it is very unlikely that they will
change the campgrounds’ location in the near future.
The location is in a separate table because i did not want to have to
change every test file, to be honest, but this also makes the map
“optional” without the need for NULL values.
I added the contact address to every public page because the new design
adds it to the footer, so i will be needing it everywhere, just like the
menu.
2023-10-06 19:21:00 +00:00
|
|
|
|
<div id="map"></div>
|
2023-12-13 22:23:28 +00:00
|
|
|
|
</div>
|
Add the contact page, containing a map with the company location
I was not sure whether to use PostGIS to store the GPS location of the
company, as i am sure i will only use that point just to show the map.
However, just in case, it is not a big deal.
There is no way to change that from the administration pages for now,
because of time constraints, and it is very unlikely that they will
change the campgrounds’ location in the near future.
The location is in a separate table because i did not want to have to
change every test file, to be honest, but this also makes the map
“optional” without the need for NULL values.
I added the contact address to every public page because the new design
adds it to the footer, so i will be needing it everywhere, just like the
menu.
2023-10-06 19:21:00 +00:00
|
|
|
|
|
|
|
|
|
{{ 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';
|
Add the contact page, containing a map with the company location
I was not sure whether to use PostGIS to store the GPS location of the
company, as i am sure i will only use that point just to show the map.
However, just in case, it is not a big deal.
There is no way to change that from the administration pages for now,
because of time constraints, and it is very unlikely that they will
change the campgrounds’ location in the near future.
The location is in a separate table because i did not want to have to
change every test file, to be honest, but this also makes the map
“optional” without the need for NULL values.
I added the contact address to every public page because the new design
adds it to the footer, so i will be needing it everywhere, just like the
menu.
2023-10-06 19:21:00 +00:00
|
|
|
|
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 }}
|