From fc1a2944afa4256b7742d17dfdb0e175f3825dde Mon Sep 17 00:00:00 2001
From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr>
Date: Wed, 15 Jan 2025 19:11:26 +0100
Subject: [PATCH] Comment working properly (close when cliking outside and good
 placement)

---
 macao/assets/custom.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/macao/assets/custom.js b/macao/assets/custom.js
index fc38ce4..076c6c5 100644
--- a/macao/assets/custom.js
+++ b/macao/assets/custom.js
@@ -12,12 +12,17 @@ $(document).ready(function() {
     $('.commentaireInfoGroup').show();
 
     // Comment popover
-    $('[spanid]').addClass('comment-trigger').popover({
-        trigger: 'click',
-        html: true,
-        content: function () {
-            return "tt" + $(this).attr('spanid');
-        }
+    $('[spanid]').addClass('comment-trigger').each(function (){
+        const spanid = $(this).attr('spanid');
+        console.log(spanid);
+        $(this).popover({
+            trigger: 'click',
+            html: true,
+            placement: 'auto',
+            content: function () {
+                return  $("[commentaireid=" + spanid + "]").html();
+            }
+        });
     });
 
     $(document).on('click', function() {
-- 
GitLab