By BD Network.
Social Sharer is a Ruby on Rails Gem, allowing you to easily create Twitter and Facebook share dialogues.
Key Features
- Easy to configure
- Easy to style
- Kept up to date with changes share systems.
Getting Started
Installation
Add this to your gemfile within your Rails project:
gem 'social_sharer', '0.1.4'
Options
Single share URL
If you require a single URL to be shared across both social networks but require simple tracking, e.g. for Google Analytics you can use the options listed below:
{
url: 'http://thisisbd.com/',
twitter_message: 'This%20is%20BD'
}
This would have Facebook link to: http://thisisbd.com/?src=fb
and your tweet contents would be: This is BD http://thisisbd.com/?src=tw
You may also add an (optional) Twitter handle to be included into the message:
{
url: 'http://thisisbd.com/',
twitter_handle: '@thisisbd',
twitter_message: 'This%20is%20BD'
}
Your tweet contents would be: This is BD via @thisisbd http://thisisbd.com/?src=tw
Multiple share URLs
If you provide different URLs for each social network, or want more flexible control over the URLs users are sharing, these options are for you:
{
individual_settings: true,
twitter: {
url: 'http://thisisbd.com/twitter_url',
message: 'This%20is%20BD'
},
facebook: {
url: 'http://thisisbd.com/facebook_url'
}
}
This would have Facebook link to: http://thisisbd.com/facebook_url
and your tweet contents would be: This is BD http://thisisbd.com/twitter_url
You may also add an (optional) Twitter handle to be included into the message:
{
individual_settings: true,
twitter: {
url: 'http://thisisbd.com/twitter_url',
handle: '@thisisbd',
message: 'This%20is%20BD'
},
facebook: {
url: 'http://thisisbd.com/facebook_url'
}
}
This would have Facebook link to: http://thisisbd.com/facebook_url
and your tweet contents would be: This is BD via @thisisbd http://thisisbd.com/twitter_url
View Helper
Within your view:
<%= social_share_tags( @social_sharer_options ) %>
Requirements
Social Sharer requires Ruby on Rails and has been tested on 4.x.
Contributing
If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.
- Clone it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
License
Social Sharer is licensed under the MIT License.