This is a gem to helper you quick create a share feature in you Rails apps.
- Google+
- Tumblr
- stumbleupon
- VK
- sina weibo
In your Gemfile
:
gem 'social-share-button', :git => 'git://github.com/zlx/social-share-button.git'
And install it:
$ bundle install
$ rails generate social_share_button:install
You can config config/initializes/social_share_button.rb
to choose which site do you want to use:
SocialShareButton.configure do |config|
config.allow_sites = %w(facebook twitter googleplus pinterest tumblr stumbleupon vk weibo)
end
You need add require css,js file in your app assets files:
app/assets/javascripts/application.coffee
#= require social-share-button
app/assets/stylesheets/application.scss
*= require social-share-button
Then you can use social_share_button_tag
helper in views, for example app/views/posts/show.html.erb
<%= social_share_button_tag(:url => "http://www.buychina.com", :title => "Buy in China", :locale => :en, :html => {:style => "margin-left: 19px; margin-top: 5px;"}) %>
http://www.buychina.com/items/mini-650-hexa-frame-xptunusokhl