Module: SinatraSocialShareButton::Helpers

Defined in:
lib/sinatra_social_share_button.rb

Instance Method Summary collapse

Instance Method Details

#social_share_button_tag(title, url, _options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/sinatra_social_share_button.rb', line 25

def social_share_button_tag(title, url, _options = {})
  allowed_sites = SinatraSocialShareButton.config.allow_sites
  html = "<div class='social-share-button'>"
  allowed_sites.each do |site|
    share_url = generate_share_url(site, url, title)
    html += "<a href='#{share_url}' target='_blank' class='share-button #{site}'>Share on #{site.capitalize}</a>"
  end
  html += '</div>'
  html
end