diff --git a/united4earth/server/models.py b/united4earth/server/models.py index 113df242d261725827de51333e59b02caafe7701..a05a262db6028f86b666348da656b1dda6fd4d9f 100644 --- a/united4earth/server/models.py +++ b/united4earth/server/models.py @@ -20,6 +20,7 @@ User = get_user_model() + class organisationSupport(Model): """Allow citizens to sign a text that is in an action group""" created_at = models.DateTimeField(auto_now_add=True) diff --git a/united4earth/server/views.py b/united4earth/server/views.py index 1b2cccf5f6f80f152a397230c7fb78e7f2fc20ae..8e7768450384e2fbb95db492a8449c609b775170 100644 --- a/united4earth/server/views.py +++ b/united4earth/server/views.py @@ -33,5 +33,4 @@ class IndexView(APIView): context['representative'] = Representative.objects.get(id=request.path.split('/')[-2]) print('context is',str(context)) - return render(request, "index.html", context) - \ No newline at end of file + return render(request, "index.html", context) \ No newline at end of file diff --git a/united4earth/static/js/main.js b/united4earth/static/js/main.js index 7127af06d1889883ac4e6cbb08d5ba6d1bc69cf9..f200c3cb3971d8165fa4be7e5ffee73f3bdf4790 100644 --- a/united4earth/static/js/main.js +++ b/united4earth/static/js/main.js @@ -560,7 +560,6 @@ function socialMediaShare(self){ var shareButtons = self?.querySelectorAll("a"); if (shareButtons) { shareButtons.forEach(shareButton => { - //listen to click on links shareButton.addEventListener("click", (e) => { //select classes to determine which platform was used @@ -589,7 +588,12 @@ function socialMediaShare(self){ //console.log("share text",shareText) //set home url - let currentPageUrl = location.href ; + let currentPageUrl = location.host + document.querySelector('solid-display-value[name="shortLink.shortLink"]').textContent; + + if (currentPageUrl == location.host) { + currentPageUrl = location.href; + } + //remove anchor in URL, if there's one currentPageUrl = currentPageUrl.replace(/#\w+.*/,''); const whatsappUrl = "https://api.whatsapp.com/send?text="; diff --git a/united4earth/templates/united4earth/action-group-detail-home.html b/united4earth/templates/united4earth/action-group-detail-home.html index 5e39176fd7d4140485e192ebbb809979e046c08e..64e523396779ec2e9c1422ca7dd5a71c964db1c8 100644 --- a/united4earth/templates/united4earth/action-group-detail-home.html +++ b/united4earth/templates/united4earth/action-group-detail-home.html @@ -2,7 +2,15 @@ {% load staticfiles %} <div data-view="action-group-detail-home" id="action-group-detail-home" hidden> <div id="action-group-loader" hidden>{%trans "Loading..."%}</div> + <!-- Display shortlink used in Js --> + <solid-display + hidden + bind-resources + name="shortLink" + fields="shortLink.shortLink" + > + </solid-display> <section class="action-details background-gray p-5 mb-6"> <div class="width-90 is-flex is-flex-direction-row">