summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-03-20 20:26:39 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commit7be636f26a4cd2857035d7d07cdf111c442566b5 (patch)
tree08ff3ad758545b74c7aa8215cb8704f09e0ef86b
parent4e9875d5c60afd43240e274865c731d488f3ce31 (diff)
💄 Hide social media sharing if apps disabled
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
-rw-r--r--css/app.css2
-rw-r--r--js/controller/ShareController.js5
-rw-r--r--templates/part.content.php32
3 files changed, 23 insertions, 16 deletions
diff --git a/css/app.css b/css/app.css
index fec34de98..8d05e36e2 100644
--- a/css/app.css
+++ b/css/app.css
@@ -107,7 +107,7 @@
.contact-input {
display: flex;
justify-content: space-between;
- margin: 0.5em 1.5em;
+ margin: 1em 1.5em;
}
.label-group {
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js
index 3289edf6a..8df57c5d0 100644
--- a/js/controller/ShareController.js
+++ b/js/controller/ShareController.js
@@ -168,6 +168,11 @@ app.controller('ShareController', function (ShareResource, Loading) {
return app in OC.appswebroots;
};
+ this.isAnySocialAppEnabled = function() {
+ let media = ['facebook', 'twitter', 'email'];
+ return media.some(m => this.isSocialAppEnabled(m));
+ };
+
this.getFacebookUrl = function(url){
return 'https://www.facebook.com/sharer/sharer.php?u='+url;
};
diff --git a/templates/part.content.php b/templates/part.content.php
index cd02569a6..cf6c71970 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -153,21 +153,23 @@
</span>
</a>
- <p class="label-group"> <?php p($l->t('Share on social media')) ?> </p>
- <div class="row">
- <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>
- </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>
- </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>
+ <div ng-if="Share.isAnySocialAppEnabled()">
+ <p class="label-group"> <?php p($l->t('Share on social media')) ?> </p>
+ <div class="row">
+ <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>
+ </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>
+ </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>
+ </div>
</div>
</div>
</div>