Closed johanlahti closed 8 years ago
Implemented so that attributes can be extracted from the search response (from the properties in the GeoJSON object):
// Options of Search.js
popupContent: "<p><span>Some content:</span> <span>${text}</span></p>",
And here a slightly hard-to-read example with an embedded function in the extraction string:
// Options of Search.js
popupContent
'${function(p) {if (p && p.url && p.url.length) {return \'<div><a target="_blank" href="\'+p.url+\'"><i class=\"fa fa-external-link\"></i> Mer information</a></div>\'} else {return ""}}}'+
'${function(p) {if (p && p.url_snedbild && p.url_snedbild.length) {return \'<div><a target="_blank" href="\'+p.url_snedbild.replace(\"xyz.malmo.se\", \"kartor.malmo.se\")+\'"><i class=\"fa fa-external-link\"></i> Visa snedbild</a></div><br />\'} else {return ""}}}',
Right not the content in the search POI's popup is hard-coded, and contains what the user searched for and a remove button. This should be possible to change (requested by a user here in Malmö stad).