From e06559a36ee929663fe182ea04b10d4d47043b80 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Wed, 17 Jan 2024 15:22:35 +0100
Subject: [PATCH] Add close icon to popover [GRIDV-73]

---
 spatial/static/spatial/js/gridmap.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js
index f339ee59..b4f9403f 100644
--- a/spatial/static/spatial/js/gridmap.js
+++ b/spatial/static/spatial/js/gridmap.js
@@ -39,6 +39,8 @@ let WMSLayersDateBucket = {};
 let map = undefined;
 let popup = undefined;
 
+
+
 /**
  * Handles moving forwards/backwards in time for the current layer type (Warning status, day degrees etc)
  * @param {Integer} dayIndex the index in the time array (0 = first day in time series)
@@ -369,6 +371,9 @@ function switchParameter(selectedParameter)
     switchLayer(document.getElementById("layerDateRange").value);
 }
 
+var myDefaultWhiteList = $.fn.tooltip.Constructor.DEFAULTS.whiteList;
+myDefaultWhiteList.i = ["aria-hidden", "onclick","style"]
+
 async function displayQueryResult(evt)
 {
     let popupElement = popup.getElement();
@@ -442,7 +447,7 @@ async function displayQueryResult(evt)
         'placement': 'top',
         'animation': false,
         'html': true,
-        'title': gettext("Map location") + ` [${wgs84Coordinate[1].toFixed(4)}, ${wgs84Coordinate[0].toFixed(4)}]`,
+        'title': gettext("Map location") + ` [${wgs84Coordinate[1].toFixed(4)}, ${wgs84Coordinate[0].toFixed(4)}] <i class="fa fa-times" style="display: inline-block; cursor: pointer; position: absolute; right: 10px;" aria-hidden="true"  onclick="$(popup.getElement()).popover('destroy');"></i>`,
         'content': '<h4>' + getWarningStatusTitle(currentWarningStatusLayer.Abstract, warningStatus) + '</h4>' + paramHTML
         });
         $(popupElement).popover('show');
-- 
GitLab