From b9fec49b66b895fb04dc35ad8bb19260f309a5b7 Mon Sep 17 00:00:00 2001 From: cherguimalih Date: Tue, 23 Mar 2021 17:04:26 +0100 Subject: =?UTF-8?q?=E2=9C=A8ShareController=20:=20Add=20intro=20in=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cherguimalih --- js/controller/ShareController.js | 14 +++++++------- templates/part.content.php | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js index 8df57c5d0..21f30608f 100644 --- a/js/controller/ShareController.js +++ b/js/controller/ShareController.js @@ -173,15 +173,15 @@ app.controller('ShareController', function (ShareResource, Loading) { return media.some(m => this.isSocialAppEnabled(m)); }; - this.getFacebookUrl = function(url){ - return 'https://www.facebook.com/sharer/sharer.php?u='+url; + this.getFacebookUrl = function(url, intro){ + return 'https://www.facebook.com/sharer/sharer.php?u='+url + '"e=' + intro.substring(0,100)+'...'; }; - this.getTwitterUrl = function(url){ - return 'https://twitter.com/intent/tweet?url='+url; - }; + this.getTwitterUrl = function(url, intro){ + return 'https://twitter.com/intent/tweet?url='+url+'&text=' +'\n'+ intro.substring(0,100)+'...'; + }; - this.getEmailUrl = function(url, object, body){ - return encodeURI('mailto:?subject=' + object + '&body=' + body + ' ' + url); + this.getEmailUrl = function(url, object, body, intro){ + return encodeURI('mailto:?subject=' + object + '&body='+intro+'...\n'+ body + '\n' + url); }; }); diff --git a/templates/part.content.php b/templates/part.content.php index 6a93c537f..3183991f9 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -159,16 +159,16 @@
+ ng-href="{{ Share.getFacebookUrl(item.url, item.intro) }}">
+ ng-href="{{ Share.getTwitterUrl(item.url, item.intro) }}">
+ ng-href="{{ Share.getEmailUrl(item.url, 't('I wanted you to see this article')) ?>', 't('Check out this article')) ?>', item.intro)}}">
-- cgit v1.2.3