Add external links for hotels to be used in maps

This commit is contained in:
Björn Fromme
2018-09-13 10:13:39 +02:00
parent 241dafb8fa
commit 3afb5a7fd6
6 changed files with 71 additions and 14 deletions
@@ -21,6 +21,10 @@
markers: {
type: Array,
default: null
},
externalLink: {
type: String,
default: null
}
},
data () {
@@ -37,6 +41,11 @@
if (this.lat && this.lng) {
const position = L.latLng(this.lat, this.lng);
const marker = L.marker(position);
if (this.externalLink) {
marker.on('click', () => {
window.open(this.externalLink, '_blank');
});
}
marker.addTo(this.map);
this.map.setView(position);
} else if (this.markers) {
@@ -44,12 +53,16 @@
for (let item of this.markers) {
const position = L.latLng(item.lat, item.lng);
const marker = L.marker(position);
if (item.externalLink) {
marker.on('click', () => {
window.open(item.externalLink, '_blank');
});
} else {
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
}
marker.addTo(this.map);
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
bounds.extend(position);
}
this.map.fitBounds(bounds);
@@ -92,9 +92,8 @@
<div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p>
<div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}">
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap>
</a>
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</div>
</div>
<f:render partial="Region/Webcam" arguments="{region: region}"/>
@@ -192,9 +191,8 @@
<div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p>
<div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}">
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap>
</a>
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</div>
</div>
<f:render partial="Region/Webcam" arguments="{region: region}"/>