0

I'm using social-share-button for my project.

When clicking the buttons, it opens a new tab to share, is there any way to make it as pop up instead of opening to a new tab?

<%= social_share_button_tag("my title", :url => "http://this is a test url") %>

should be something like facebook share plugin. Clicking the share button just opens a small pop up window, and after sharing it closes.

or anyone can lead me to a better rails gem to help me with facebook/twitter sharing?

galao
  • 1,281
  • 8
  • 26
  • 50

3 Answers3

2

In the documentation of this gem you could pass a block of argument in the function you are calling to generate your link like in this example

<%= social_share_button_tag(@post.title, :name => "galao", :target => "_blank" other =>"other block as you wish") %>

No social_share_button is the only one that I know but as it doesn't displays 100% as you like you could try instead implementing a javascript library instead.

you could use any javascript libraries for the popup

have you try https://github.com/sonnyt/prettySocial demo

jquery-plugin for social

...have you look at ruby-toolbox in case there is one that could fit your needss

Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101
  • i have tried `<%= social_share_button_tag("my title", :name => "test", :target => "_blank", :url => "http://this is a test url") %>` but this still opens a new tab, what i wanted to do is open a small popup window with the facbebook share page in it – galao Sep 02 '14 at 03:55
  • sorry I didn't understand your question at first :( – Papouche Guinslyzinho Sep 02 '14 at 04:12
1

The documentation for this gem shows you can use the following to enable a popup:

<%= social_share_button_tag(@post.title, :popup => "true")

However there was a bug. The fix has been committed to the Github repo, but a new version of the Gem has not been released. Instead of including this in your Gemfile:

gem 'social-share-button', '~> 0.1.8'

Use this:

gem 'social-share-button', github: "huacnlee/social-share-button"

Run bundle and restart your app. This should fix the problem.

dheeraji
  • 127
  • 1
  • 8
0

You can get it to pop-up instead of opening a new tab by adding :popup => "true"

like this:

<%= social_share_button_tag("my title", :url => "http://this is a test url", :popup => "true") %>
camillavk
  • 521
  • 5
  • 20