From f47bf8b196cef5c9424c3237ff65acc1c0269c41 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Tue, 10 Apr 2018 10:53:10 +0200
Subject: [PATCH] hotline #72999 call openStreetmap js plugin after reloading
 widget

---
 VERSIONS_HOTLINE/72999                        | 2 ++
 public/opac/js/openStreetMap/openStreetMap.js | 6 ++++++
 public/opac/js/reload_module.js               | 3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 VERSIONS_HOTLINE/72999

diff --git a/VERSIONS_HOTLINE/72999 b/VERSIONS_HOTLINE/72999
new file mode 100644
index 00000000000..9a0a5596248
--- /dev/null
+++ b/VERSIONS_HOTLINE/72999
@@ -0,0 +1,2 @@
+ - ticket #72999 : Boite biliothèque : correction de l'affichage de la carte OpenStreetMap en pagination.
+ 
\ No newline at end of file
diff --git a/public/opac/js/openStreetMap/openStreetMap.js b/public/opac/js/openStreetMap/openStreetMap.js
index 4bbc9353255..203e7ed9a42 100644
--- a/public/opac/js/openStreetMap/openStreetMap.js
+++ b/public/opac/js/openStreetMap/openStreetMap.js
@@ -97,3 +97,9 @@
     widget.ajaxComplete(loadMap);
   }
 } (jQuery))
+
+
+function initOpenStreetMap(widget) {
+  if (0 < $(widget).find(".leaflet_osm").length)
+    widget.openStreetMap();
+}
diff --git a/public/opac/js/reload_module.js b/public/opac/js/reload_module.js
index e53d3266416..5ea12975534 100644
--- a/public/opac/js/reload_module.js
+++ b/public/opac/js/reload_module.js
@@ -1,12 +1,14 @@
 (function($) {
   $.fn.reload = function(url) {
     var boite = $(this);
+
     $.get(url, function(data) {
       var new_content= $(data).children();
       boite.empty().append(new_content);
       initializeDivisionFive();
       initializePopups();
       initializeReloadModule();
+      initOpenStreetMap(boite);
       setupAnchorsTarget();
       boite
         .boiteSlideToRight()
@@ -16,7 +18,6 @@
   } 
 })(jQuery);
 
-
 function initializeReloadModule() {
   $('.boite a[data-ajax-reload="true"]').click(function(event) {
     event.preventDefault();
-- 
GitLab