openstreetmap-website icon indicating copy to clipboard operation
openstreetmap-website copied to clipboard

Add social sharing functionality

Open kcne opened this issue 7 months ago • 7 comments

Add social network sharing to diary entry pages

Description: This PR addresses the issue #1391 by introducing social media sharing functionality for diary entries, allowing users to share posts on platforms like Twitter, Facebook, LinkedIn, Mastodon, Telegram, and Email. It includes required JavaScript to handle opening share URLs in pop-up windows and Ruby helper methods to filter and validate allowed social media sites. The changes also incorporate error logging for invalid sites and missing icons, ensuring robustness.

Implementation details:

  • lib/social_share_button_helper.rb - config, validation & helper functions
  • render_social_share_buttons function inside application_helper.rb responsible for rendering the buttons with helper utilization
  • social_share_button.js - javascript utility functions for opening the popups, generating urls for sharing & handling onclick events on buttons

Screenshots: Screenshot 2024-07-17 at 16 05 18 Screenshot 2024-07-17 at 16 07 12

Reviews welcome, Thank you.

kcne avatar Jul 13 '24 20:07 kcne