Skip to content
Snippets Groups Projects
Commit 5d10cb70 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #143830 call links event binding on openSteetMap popup

parent 54704dcb
No related merge requests found
Pipeline #17162 canceled with stage
in 8 minutes and 42 seconds
- correctif #143830 : Magasin de thèmes : Correction du bouton réserver dans la carte des bibliothèques des exemplaires. Le choix de retrait s'affiche maintenant correctement.
\ No newline at end of file
......@@ -24,6 +24,11 @@
var loadMap = function() {
var container = widget.find('.leaflet_osm');
container.innerHTML = '';
if(null != (initialized = L.DomUtil.get(container.attr('id'))))
initialized._leaflet_id = null;
var disable_zoom_animation = container.data('osm-disable-zoom-animation');
var map = L.map(container.attr('id'),
......@@ -123,13 +128,30 @@
originalPosition();
});
map.on('popupopen', function(event) {
$('.leaflet-popup-content img').on('load', function() {
$('.leaflet-popup-content img').on('load', function(e) {
event.popup.update();
})
});
widget.on('mouseover', function(e) {
if ( ! widget.find('.leaflet-popup-content a[data-popup]').length)
return;
if ( typeof initializePopups === 'function')
initializePopups();
if ( typeof setupAnchorsTarget === 'function')
setupAnchorsTarget();
});
if ( typeof initializePopups === 'function')
initializePopups();
if ( typeof setupAnchorsTarget === 'function')
setupAnchorsTarget();
});
originalPosition();
if (relative_zoom)
map.zoomIn(relative_zoom);
......
......@@ -35,7 +35,7 @@
<div
id="map"
class="leaflet_osm"
data-osm="[{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\&quot;>Concarneau<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;open&quot;,&quot;lat&quot;:&quot;47.8707978&quot;,&quot;lon&quot;:&quot;-3.9189743&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/elliant\&quot;>Elliant<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.996042&quot;,&quot;lon&quot;:&quot;-3.889371&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/melgven\&quot;>Melgven<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.906185&quot;,&quot;lon&quot;:&quot;-3.834563&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/nevez\&quot;>N\u00e9vez<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.8193549&quot;,&quot;lon&quot;:&quot;-3.7929785&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/pont_aven\&quot;>Pont-Aven<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.856974&quot;,&quot;lon&quot;:&quot;-3.743023&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/rosporden\&quot;>Rosporden<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.957613&quot;,&quot;lon&quot;:&quot;-3.827298&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/saint_yvi\&quot;>Saint-Yvi<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.967416&quot;,&quot;lon&quot;:&quot;-3.9402003&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/tregunc\&quot;>Tr\u00e9gunc<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.856571&quot;,&quot;lon&quot;:&quot;-3.8538288&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/tourc_h\&quot;>Tourc\u2019h<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;48.025213&quot;,&quot;lon&quot;:&quot;-3.82555&quot;}]"
data-osm="[{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\&quot; data-popup=\&quot;true\&quot;>Concarneau<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;open&quot;,&quot;lat&quot;:&quot;47.8707978&quot;,&quot;lon&quot;:&quot;-3.9189743&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/elliant\&quot;>Elliant<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.996042&quot;,&quot;lon&quot;:&quot;-3.889371&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/melgven\&quot;>Melgven<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.906185&quot;,&quot;lon&quot;:&quot;-3.834563&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/nevez\&quot;>N\u00e9vez<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.8193549&quot;,&quot;lon&quot;:&quot;-3.7929785&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/pont_aven\&quot;>Pont-Aven<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.856974&quot;,&quot;lon&quot;:&quot;-3.743023&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/rosporden\&quot;>Rosporden<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.957613&quot;,&quot;lon&quot;:&quot;-3.827298&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/saint_yvi\&quot;>Saint-Yvi<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.967416&quot;,&quot;lon&quot;:&quot;-3.9402003&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/tregunc\&quot;>Tr\u00e9gunc<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;47.856571&quot;,&quot;lon&quot;:&quot;-3.8538288&quot;},{&quot;html&quot;:&quot;<section><h2><a href=\&quot;\/ma-mediatheque\/tourc_h\&quot;>Tourc\u2019h<\/a><\/h2><div class=\&quot;fields\&quot;><\/div><\/section>&quot;,&quot;status&quot;:&quot;close&quot;,&quot;lat&quot;:&quot;48.025213&quot;,&quot;lon&quot;:&quot;-3.82555&quot;}]"
data-osm-geojson=""
data-osm-layer="1"
data-osm-zoom="0"
......@@ -51,6 +51,7 @@
<script src="../../java/leaflet.fullscreen-master/Leaflet.fullscreen.min.js"></script>
<script src="openStreetMap.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.13.0.js"></script>
<script src="../subModal.js"></script>
<script src="tests.js"></script>
</body>
</html>
......@@ -90,3 +90,12 @@ test('without osm_zoom after click page should return to absolute zoom 10', func
$('.leaflet-popup-close-button')[0].click();
equal(10, $('#map')[0].map.getZoom());
});
test('after popup click anchor should have an event binded', function() {
$('#map-container').openStreetMap();
$('.leaflet-marker-icon:first-child')[0].click();
$('.leaflet-popup-close-button')[0].click();
events = $._data($('a[href="/ma-mediatheque"]')[0], 'events');
equal(events['click'] !== undefined, true);
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment