[openstreetmap/openstreetmap-website] Add social sharing functionality (PR #4985)

Anton Khorev notifications at github.com
Thu Aug 15 13:22:10 UTC 2024


@AntonKhorev commented on this pull request.



> +
+    # Log invalid sites
+    invalid_sites.each do |invalid_site|
+      Rails.logger.error("Invalid site or icon not configured: #{invalid_site}")
+    end
+
+    tag.div(
+      :class => "social-share-button d-flex gap-1 align-items-end flex-wrap"
+    ) do
+      valid_sites.map do |site|
+        link_to SocialShareButtonHelper.generate_share_url(site, opts), {
+          :rel => ["nofollow", opts[:rel]].compact,
+          :class => "ssb-icon",
+          :title => "Share on #{site.capitalize}"
+        } do
+          image_tag(SocialShareButtonHelper.icon_path(site), :alt => site.capitalize, :size => 28)

`:alt => site.capitalize`: "email" is not a proper site name, you'll have to translate it instead of just capitalizing. 

You'll have something like:
https://github.com/openstreetmap/openstreetmap-website/blob/1b288d40c7fff3d3be8d82d4e96c9008778f4dba/config/locales/en.yml#L2597-L2614

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4985#pullrequestreview-2240383961
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4985/review/2240383961 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240815/3fa78a7b/attachment.htm>


More information about the rails-dev mailing list