Skip to content

Commit

Permalink
Fix icon transparent bug;
Browse files Browse the repository at this point in the history
Add more site share Baidu, Kaixin001, Google+,Renren,QQ Weibo;
Version to 0.0.5.
  • Loading branch information
huacnlee committed Aug 3, 2012
1 parent 4be206b commit 93bfb25
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 21 deletions.
5 changes: 5 additions & 0 deletions Changelogs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
== 0.0.5

* Transparent icon
* More site added (Renren,TQQ, Google+, Baidu, Kaixin001)

== 0.0.4

* Add image support for Weibo share.
Expand Down
33 changes: 23 additions & 10 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@

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

# Sites list

* Facebook
* Twitter
* Douban
* Google+
* Weibo
* QZone
* Tencent Weibo
* Renren
* Hi Baidu
* Kaixin001

## Screenshot

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

## Install

in your `Gemfile`:
In your `Gemfile`:

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

an install it:
And install it:

```bash
$ bundle install
Expand All @@ -23,19 +36,19 @@ $ rails generate social_share_button:install

## Configure

you can create this content in `config/initializes/social_share_button.rb`:
You can config `config/initializes/social_share_button.rb` to choose which site do you want to use:

```ruby
SocialShareButton.configure do |config|
config.allow_sites = %w(twitter facebook weibo douban)
config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu)
end
```

## Usage

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

`app/assets/javascripts/application.cofee`
`app/assets/javascripts/application.coffee`

```
#= require social-share-button
Expand All @@ -47,13 +60,13 @@ you need add require css,js file in your app assets files:
*= require social-share-button
```

then you can use `social_share_button_tag` helper in views, for example `app/views/posts/show.html.erb`
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:
And you can custom rel attribute:

```erb
<%= social_share_button_tag(@post.title, :rel => "twipsy") %>
Expand Down
Binary file modified lib/assets/images/.DS_Store
Binary file not shown.
Binary file added lib/assets/images/sprites/.DS_Store
Binary file not shown.
Binary file modified lib/assets/images/sprites/social-share-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/assets/images/sprites/social-share-button/douban.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/assets/images/sprites/social-share-button/facebook.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/assets/images/sprites/social-share-button/qq.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion lib/assets/javascripts/social-share-button.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ window.SocialShareButton =
openUrl : (url) ->
window.open(url)
false

share : (el) ->
site = $(el).data('site')
title = encodeURIComponent($(el).parent().data('title'))
Expand All @@ -21,4 +21,12 @@ window.SocialShareButton =
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}")
when "tqq"
SocialShareButton.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}")
when "baidu"
SocialShareButton.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=")
when "kaixin001"
SocialShareButton.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}")
when "renren"
SocialShareButton.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=")
when "google_plus"
SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
false
30 changes: 24 additions & 6 deletions lib/assets/stylesheets/social-share-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
Creating a sprite from following images:
lib/assets/images/sprites/social-share-button/baidu.png (16x16)
lib/assets/images/sprites/social-share-button/delicious.png (16x16)
lib/assets/images/sprites/social-share-button/douban.png (16x16)
lib/assets/images/sprites/social-share-button/email.png (16x16)
lib/assets/images/sprites/social-share-button/facebook.png (16x16)
lib/assets/images/sprites/social-share-button/flickr.png (16x16)
lib/assets/images/sprites/social-share-button/google.png (16x16)
lib/assets/images/sprites/social-share-button/google_plus.png (16x16)
lib/assets/images/sprites/social-share-button/kaixin001.png (16x16)
lib/assets/images/sprites/social-share-button/qq.png (16x16)
lib/assets/images/sprites/social-share-button/renren.png (16x16)
lib/assets/images/sprites/social-share-button/tqq.png (16x16)
lib/assets/images/sprites/social-share-button/twitter.png (16x16)
lib/assets/images/sprites/social-share-button/weibo.png (16x16)
Expand All @@ -13,12 +22,21 @@
lib/assets/stylesheets/social-share-button.scss
Output size:
48x32
64x64
*/
.social-share-button-douban { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px 0px no-repeat }
.social-share-button-facebook { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px 0px no-repeat }
.social-share-button-qq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -16px no-repeat }
.social-share-button-twitter { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -16px no-repeat }
.social-share-button-weibo { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px 0px no-repeat }
.social-share-button-baidu { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px 0px no-repeat }
.social-share-button-delicious { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px 0px no-repeat }
.social-share-button-douban { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -16px no-repeat }
.social-share-button-email { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -16px no-repeat }
.social-share-button-facebook { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px 0px no-repeat }
.social-share-button-flickr { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px -16px no-repeat }
.social-share-button-google { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -32px no-repeat }
.social-share-button-google_plus { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -32px no-repeat }
.social-share-button-kaixin001 { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px -32px no-repeat }
.social-share-button-qq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px 0px no-repeat }
.social-share-button-renren { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px -16px no-repeat }
.social-share-button-tqq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px -32px no-repeat }
.social-share-button-twitter { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -48px no-repeat }
.social-share-button-weibo { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -48px no-repeat }
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SocialShareButton.configure do |config|
config.allow_sites = %w(twitter facebook weibo douban qq)
config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu)
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ en:
douban: Douban
qq: Qzone
tqq: Tqq

delicious: Delicious
baidu: Baidu.com
kaixin001: Kaixin001.com
renren: Renren.com
google_plus: Google+
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
facebook: Facebook
douban: 豆瓣
qq: QQ空间
tqq: 腾讯微博
tqq: 腾讯微博
delicious: Delicious
baidu: 百度收藏
kaixin001: 开心网
renren: 人人网
google_plus: Google+
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
facebook: Facebook
douban: 豆瓣
qq: QQ空間
tqq: 腾讯微博
tqq: 腾讯微博
delicious: Delicious
baidu: 百度收藏
kaixin001: 開心網
renren: 人人網
google_plus: Google+
Binary file modified psd/icon_templet.psd
Binary file not shown.

0 comments on commit 93bfb25

Please sign in to comment.