From a9b03ef557861c2db8fc4354b2011631741e5f25 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 3 Apr 2025 16:30:58 +0300 Subject: [PATCH] Add hidden share button The image is from https://icons.getbootstrap.com/icons/share/ , shifted 1px to the left. --- app/assets/images/social_icons/share.svg | 3 +++ app/helpers/social_share_button_helper.rb | 16 ++++++++++++++-- config/locales/en.yml | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/social_icons/share.svg diff --git a/app/assets/images/social_icons/share.svg b/app/assets/images/social_icons/share.svg new file mode 100644 index 000000000..0eb1f772d --- /dev/null +++ b/app/assets/images/social_icons/share.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/helpers/social_share_button_helper.rb b/app/helpers/social_share_button_helper.rb index f9ffa88bc..b9c8e309e 100644 --- a/app/helpers/social_share_button_helper.rb +++ b/app/helpers/social_share_button_helper.rb @@ -16,7 +16,17 @@ module SocialShareButtonHelper tag.div( :class => "social-share-buttons d-flex gap-1 align-items-end flex-wrap mb-3" ) do - safe_join(SOCIAL_SHARE_CONFIG.map do |site, icon| + buttons = [ + tag.button(:type => "button", + :class => "btn btn-secondary p-1 border-1 rounded-circle", + :title => I18n.t("application.share.share.title"), + :hidden => true, + :data => { :share_type => "native" }) do + image_tag("social_icons/share.svg", :alt => I18n.t("application.share.share.alt"), :size => 18, :class => "d-block") + end + ] + + buttons << SOCIAL_SHARE_CONFIG.map do |site, icon| link_options = { :rel => "nofollow", :class => "rounded-circle focus-ring", @@ -28,7 +38,9 @@ module SocialShareButtonHelper link_to generate_share_url(site, title, url), link_options do image_tag(icon, :alt => I18n.t("application.share.#{site}.alt"), :size => 28) end - end, "\n") + end + + safe_join(buttons, "\n") end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 16b967ead..f09afa48d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2734,6 +2734,9 @@ en: title: Log in with Wikipedia alt: Wikipedia logo share: + share: + title: Share + alt: Share Icon email: title: Share via Email alt: Email icon -- 2.39.5