Gustavo Luigi 2023-08-01 16:58:48 -03:00
parent 903bdb5e1b
commit 29d29288a0
2 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ function initMap() {
let infowindowElement = $("#marker-window").clone();
infowindowElement.html(infowindowElement.html().replace('$title', item.title));
infowindowElement.html(infowindowElement.html().replace('$description', item.description ?? ''));
infowindowElement.html(infowindowElement.html().replace('data-href="$path"', 'href="' + item.path + '"'));
infowindowElement.find(".path").attr("href", item.path);
infowindowElement.removeClass('d-none');
return infowindowElement[0].outerHTML;
}
@ -143,7 +143,7 @@ function initMap() {
let locationElement = locationElementTemplate.clone();
locationElement.html(locationElement.html().replace('$title', item.title));
locationElement.html(locationElement.html().replace('data-src="$image"', 'src="' + item.image + '"'));
locationElement.html(locationElement.html().replace('data-href="$path"', 'href="' + item.path + '"'));
locationElement.find(".path").attr("href", item.path);

let location = item[textToSlug(locationField)];
if (location && location.postalCode) locationElement.html(locationElement.html().replace('$postalCode', (location.postalCode + " " + (location.addressLocality ?? "")).trim()));
@ -151,7 +151,7 @@ function initMap() {

locationElement.removeClass('d-none');

if (item[textToSlug(tagField)]) item[textToSlug(tagField)].slice(0, 2).forEach(function (besonderheitenItem) {
if (item[textToSlug(tagField)] && Array.isArray(item[textToSlug(tagField)])) item[textToSlug(tagField)].slice(0, 2).forEach(function (besonderheitenItem) {
locationElement.find(".tags").append(`<span class="badge text-bg-secondary">${besonderheitenItem}</span>`);
});


View File

@ -113,7 +113,7 @@
<div id="bodyContent">
<img class="img-fluid rounded" data-src="$image" alt="">
<p>$description</p>
<a data-href="$path" style="outline: none;">Details</a>
<a href="" class="path" style="outline: none;">Details</a>
</div>
</div>
</div>