module Rrssb module Rails module ButtonsHelper def rrssb_tag(opts={}) buttons = opts[:buttons] || [] url = opts.delete(:url) { '#' } contents = opts[:contents] || {} html = [] html << "
' raw html.join("\n") end # cf. https://github.com/huacnlee/social-share-button def social_url(button, url, opts={}) case button when 'facebook' then "https://www.facebook.com/sharer/sharer.php?u=#{url}" when 'twitter' via = opts.delete(:via) { nil } text = opts.delete(:text) { '' } "https://twitter.com/intent/tweet?url=#{url}&text=#{text}&via=#{via}" when 'google_plus' then "https://plus.google.com/share?url=#{url}" else url end end end end end