From 952d5b57c6941795690bd4a483c882cb219e3521 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Fri, 15 Nov 2019 10:11:26 +0100
Subject: [PATCH] inpiration from happy dev web site

---
 src/includes/mentor/resources/detail.pug | 12 +++++++-----
 src/scripts/coopstarter.js               |  5 +++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug
index b9109836..f93829f9 100644
--- a/src/includes/mentor/resources/detail.pug
+++ b/src/includes/mentor/resources/detail.pug
@@ -102,11 +102,13 @@ include ../../components/widgets
       widget-@id = 'cs-display-email-button'
     )
 
-    sib-display.twitter-link(
-      bind-resources
-      fields="@id"
-      widget-@id = 'cs-display-twitter-button'
-    )
+    //- sib-display#shareByTwitter.twitter-link.twshare(
+    //-   bind-resources
+    //-   fields="@id"
+    //-   widget-@id = 'cs-display-twitter-button'
+    //- )
+  script(async src="https://platform.twitter.com/widgets.js" charset="utf-8")
+  a(href="", target="_blank")#shareByTwitter.twshare.mdi.mdi-twitter
       
 
   sib-display(
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index bed5c99e..94b7046b 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -618,6 +618,11 @@ jQuery(document).ready(function($) {
     });
   }
 
+  //Manage the twitter button
+  $("#shareByTwitter").on("populate", function (e) {
+    var valUrl = window.location.href;
+    $('.twshare').attr("href", "https://twitter.com/intent/tweet?original_referer=http%3A%2F%2F127.0.0.1%3A3000%2Fevenements&amp;ref_src=twsrc%5Etfw&amp;tw_p=tweetbutton&amp;url=" + valUrl + "&amp;");
+  });
   //Manage the logout action
   manageLogoutButton();
 
-- 
GitLab