<commit_before># Social Share Button

This is a gem to helper you quick create a share feature in you Rails apps.

## Screenshot

![img](http://l.ruby-china.org/photo/00cc56853b29b5d90458d39e855a936d.png)

## Install

in your `Gemfile`:

    gem 'social-share-button'
    
an install it:

    $ bundle install
    $ rails generate social_share_button:install
    
## Configure

you can create this content in `config/initializes/social_share_button.rb`:

    SocialShareButton.configure do |config|
      config.allow_sites = %w(twitter facebook weibo douban)
    end
    
## Usage

you need add require css,js file in your app assets files:

`app/assets/javascripts/application.js`

    //= require social-share-button
    
`app/assets/stylesheets/application.css`

    *= 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(@post.title) %>

and you can custom rel attribute:

    <%= social_share_button_tag(@post.title, :rel => "twipsy") %>
    
## Demo

[http://ruby-china.org/wiki/about](http://ruby-china.org/wiki/about)<commit_msg>Update readme.<commit_after># Social Share Button

This is a gem to helper you quick create a share feature in you Rails apps.

## Screenshot

![img](http://l.ruby-china.org/photo/00cc56853b29b5d90458d39e855a936d.png)

## Install

in your `Gemfile`:

```ruby
gem 'social-share-button'
```

an install it:

```bash
$ bundle install
$ rails generate social_share_button:install
```

## Configure

you can create this content in `config/initializes/social_share_button.rb`:

```ruby
SocialShareButton.configure do |config|
  config.allow_sites = %w(twitter facebook weibo douban)
end
```
    
## Usage

you need add require css,js file in your app assets files:

`app/assets/javascripts/application.cofee`

```
#= 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`

```erb
<%= social_share_button_tag(@post.title) %>
```

and you can custom rel attribute:

```erb
<%= social_share_button_tag(@post.title, :rel => "twipsy") %>
```

## Demo

[http://ruby-china.org/wiki/about](http://ruby-china.org/wiki/about)
{'fraction_non_alphanumeric': 0.1296137339055794, 'fraction_numerical': 0.019742489270386267, 'mean_word_length': 4.214765100671141, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4961170', 'n_tokens_mistral': 866, 'n_tokens_neox': 781, 'n_words': 193}