diff options
author | cherguimalih <ilyes.chergui-malih@etu.unistra.fr> | 2021-03-23 17:04:26 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 23:17:31 +0200 |
commit | b9fec49b66b895fb04dc35ad8bb19260f309a5b7 (patch) | |
tree | fadf15bb701239395733b94079f2794547c1f300 | |
parent | 31c4e2830ade156def01186da564b532ca96b5e9 (diff) |
✨ShareController : Add intro in links
Signed-off-by: cherguimalih <ilyes.chergui-malih@etu.unistra.fr>
-rw-r--r-- | js/controller/ShareController.js | 14 | ||||
-rw-r--r-- | 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 @@ <div ng-if="Share.isSocialAppEnabled('facebook')" class="col-4"> <a target="_blank" class="icon-dropdown icon-facebook pr-5" - ng-href="{{ Share.getFacebookUrl(item.url) }}"></a> + ng-href="{{ Share.getFacebookUrl(item.url, item.intro) }}"></a> </div> <div ng-if="Share.isSocialAppEnabled('twitter')" class="col-4"> <a target="_blank" class="icon-dropdown icon-twitter pr-5" - ng-href="{{ Share.getTwitterUrl(item.url) }}"></a> + ng-href="{{ Share.getTwitterUrl(item.url, item.intro) }}"></a> </div> <div ng-if="Share.isSocialAppEnabled('email')" class="col-4"> <a class="icon-dropdown icon-mail pr-5" - ng-href="{{ Share.getEmailUrl(item.url, '<?php p($l->t('I wanted you to see this article')) ?>', '<?php p($l->t('Check out this article')) ?>') }}"></a> + ng-href="{{ Share.getEmailUrl(item.url, '<?php p($l->t('I wanted you to see this article')) ?>', '<?php p($l->t('Check out this article')) ?>', item.intro)}}"></a> </div> </div> </div> |