From 55414cf6eab430f1ae293387703bbde265442210 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 13 Aug 2022 21:32:22 +0200 Subject: [PATCH] Overhaul the message share providers and buttons --- .../templates/headIncludeJavaScript.tpl | 18 +-- com.woltlab.wcf/templates/shareButtons.tpl | 36 ++--- ts/WoltLabSuite/Core/BootstrapFrontend.ts | 8 +- ts/WoltLabSuite/Core/Ui/Message/Share.ts | 14 +- .../Core/Ui/Message/Share/Dialog.ts | 24 ++-- .../Core/Ui/Message/Share/Providers.ts | 91 ++---------- .../js/WoltLabSuite/Core/BootstrapFrontend.js | 7 +- .../js/WoltLabSuite/Core/Ui/Message/Share.js | 14 +- .../Core/Ui/Message/Share/Dialog.js | 21 +-- .../Core/Ui/Message/Share/Providers.js | 87 ++---------- .../IconFunctionTemplatePlugin.class.php | 12 ++ .../install/files/style/ui/shareButtons.scss | 130 +++++++----------- 12 files changed, 159 insertions(+), 303 deletions(-) diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index fa3e3a88dc..ece17e7243 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -144,13 +144,6 @@ window.addEventListener('pageshow', function(event) { 'wcf.global.form.password.button.hide': '{jslang}wcf.global.form.password.button.hide{/jslang}', 'wcf.global.form.password.button.show': '{jslang}wcf.global.form.password.button.show{/jslang}', 'wcf.message.share': '{jslang}wcf.message.share{/jslang}', - 'wcf.message.share.facebook': '{jslang}wcf.message.share.facebook{/jslang}', - 'wcf.message.share.twitter': '{jslang}wcf.message.share.twitter{/jslang}', - 'wcf.message.share.reddit': '{jslang}wcf.message.share.reddit{/jslang}', - 'wcf.message.share.whatsApp': '{jslang}wcf.message.share.whatsApp{/jslang}', - 'wcf.message.share.linkedIn': '{jslang}wcf.message.share.linkedIn{/jslang}', - 'wcf.message.share.pinterest': '{jslang}wcf.message.share.pinterest{/jslang}', - 'wcf.message.share.xing': '{jslang}wcf.message.share.xing{/jslang}', 'wcf.message.share.permalink': '{jslang}wcf.message.share.permalink{/jslang}', 'wcf.message.share.permalink.bbcode': '{jslang}wcf.message.share.permalink.bbcode{/jslang}', 'wcf.message.share.permalink.html': '{jslang}wcf.message.share.permalink.html{/jslang}', @@ -190,7 +183,16 @@ window.addEventListener('pageshow', function(event) { enableUserPopover: {if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile')}true{else}false{/if}, executeCronjobs: {if $executeCronjobs}true{else}false{/if}, {if ENABLE_SHARE_BUTTONS} - shareButtonProviders: [{implode from="\n"|explode:SHARE_BUTTONS_PROVIDERS item=shareButtonProvider}'{$shareButtonProvider}'{/implode}], + {assign var='__shareProviders' value="\n"|explode:SHARE_BUTTONS_PROVIDERS} + shareButtonProviders: [ + {if 'Facebook'|in_array:$__shareProviders}["Facebook", "{jslang}wcf.message.share.facebook{/jslang}", {icon size=24 name='facebook' type='brand' encodeJson=true}],{/if} + {if 'Twitter'|in_array:$__shareProviders}["Twitter", "{jslang}wcf.message.share.twitter{/jslang}", {icon size=24 name='twitter' type='brand' encodeJson=true}],{/if} + {if 'Reddit'|in_array:$__shareProviders}["Reddit", "{jslang}wcf.message.share.reddit{/jslang}", {icon size=24 name='reddit' type='brand' encodeJson=true}],{/if} + {if 'WhatsApp'|in_array:$__shareProviders}["WhatsApp", "{jslang}wcf.message.share.whatsApp{/jslang}", {icon size=24 name='whatsapp' type='brand' encodeJson=true}],{/if} + {if 'LinkedIn'|in_array:$__shareProviders}["LinkedIn", "{jslang}wcf.message.share.linkedIn{/jslang}", {icon size=24 name='linkedin-in' type='brand' encodeJson=true}],{/if} + {if 'Pinterest'|in_array:$__shareProviders}["Pinterest", "{jslang}wcf.message.share.pinterest{/jslang}", {icon size=24 name='pinterest' type='brand' encodeJson=true}],{/if} + {if 'XING'|in_array:$__shareProviders}["XING", "{jslang}wcf.message.share.xing{/jslang}", {icon size=24 name='xing' type='brand' encodeJson=true}],{/if} + ], {/if} styleChanger: {if $__wcf->getStyleHandler()->showStyleChanger()}true{else}false{/if} }); diff --git a/com.woltlab.wcf/templates/shareButtons.tpl b/com.woltlab.wcf/templates/shareButtons.tpl index a7b5293e19..5744f25d09 100644 --- a/com.woltlab.wcf/templates/shareButtons.tpl +++ b/com.woltlab.wcf/templates/shareButtons.tpl @@ -4,58 +4,58 @@