social-share-button 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/Changelogs.md +5 -0
  2. data/README.md +77 -0
  3. data/lib/assets/images/.DS_Store +0 -0
  4. data/lib/assets/images/sprites/.DS_Store +0 -0
  5. data/lib/assets/images/sprites/social-share-button.png +0 -0
  6. data/lib/assets/images/sprites/social-share-button/baidu.png +0 -0
  7. data/lib/assets/images/sprites/social-share-button/delicious.png +0 -0
  8. data/lib/assets/images/sprites/social-share-button/douban.png +0 -0
  9. data/lib/assets/images/sprites/social-share-button/email.png +0 -0
  10. data/lib/assets/images/sprites/social-share-button/facebook.png +0 -0
  11. data/lib/assets/images/sprites/social-share-button/flickr.png +0 -0
  12. data/lib/assets/images/sprites/social-share-button/google.png +0 -0
  13. data/lib/assets/images/sprites/social-share-button/google_plus.png +0 -0
  14. data/lib/assets/images/sprites/social-share-button/kaixin001.png +0 -0
  15. data/lib/assets/images/sprites/social-share-button/qq.png +0 -0
  16. data/lib/assets/images/sprites/social-share-button/renren.png +0 -0
  17. data/lib/assets/images/sprites/social-share-button/tqq.png +0 -0
  18. data/lib/assets/javascripts/social-share-button.coffee +11 -1
  19. data/lib/assets/stylesheets/social-share-button.scss +24 -6
  20. data/lib/generators/social_share_button/templates/config/initializers/social_share_button.rb +1 -1
  21. data/lib/generators/social_share_button/templates/config/locales/social_share_button.en.yml +8 -3
  22. data/lib/generators/social_share_button/templates/config/locales/social_share_button.zh-CN.yml +8 -2
  23. data/lib/generators/social_share_button/templates/config/locales/social_share_button.zh-TW.yml +8 -2
  24. data/lib/social_share_button/config.rb +0 -4
  25. data/lib/social_share_button/helper.rb +1 -1
  26. data/lib/social_share_button/version.rb +1 -1
  27. data/psd/icon_templet.psd +0 -0
  28. metadata +22 -6
  29. data/README.markdown +0 -50
data/Changelogs.md CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.5
2
+
3
+ * Transparent icon
4
+ * More site added (Renren,TQQ, Google+, Baidu, Kaixin001)
5
+
1
6
  == 0.0.4
2
7
 
3
8
  * Add image support for Weibo share.
data/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Social Share Button
2
+
3
+ This is a gem to helper you quick create a share feature in you Rails apps.
4
+
5
+ # Sites list
6
+
7
+ * Facebook
8
+ * Twitter
9
+ * Douban
10
+ * Google+
11
+ * Weibo
12
+ * QZone
13
+ * Tencent Weibo
14
+ * Renren
15
+ * Hi Baidu
16
+ * Kaixin001
17
+
18
+ ## Screenshot
19
+
20
+ ![img](http://l.ruby-china.org/photo/3c9633ac35c56be800ef9592ad594c4b.png)
21
+
22
+ ## Install
23
+
24
+ In your `Gemfile`:
25
+
26
+ ```ruby
27
+ gem 'social-share-button'
28
+ ```
29
+
30
+ And install it:
31
+
32
+ ```bash
33
+ $ bundle install
34
+ $ rails generate social_share_button:install
35
+ ```
36
+
37
+ ## Configure
38
+
39
+ You can config `config/initializes/social_share_button.rb` to choose which site do you want to use:
40
+
41
+ ```ruby
42
+ SocialShareButton.configure do |config|
43
+ config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu)
44
+ end
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ You need add require css,js file in your app assets files:
50
+
51
+ `app/assets/javascripts/application.coffee`
52
+
53
+ ```
54
+ #= require social-share-button
55
+ ```
56
+
57
+ `app/assets/stylesheets/application.scss`
58
+
59
+ ```
60
+ *= require social-share-button
61
+ ```
62
+
63
+ Then you can use `social_share_button_tag` helper in views, for example `app/views/posts/show.html.erb`
64
+
65
+ ```erb
66
+ <%= social_share_button_tag(@post.title) %>
67
+ ```
68
+
69
+ And you can custom rel attribute:
70
+
71
+ ```erb
72
+ <%= social_share_button_tag(@post.title, :rel => "twipsy") %>
73
+ ```
74
+
75
+ ## Demo
76
+
77
+ [http://ruby-china.org/wiki/about](http://ruby-china.org/wiki/about)
Binary file
Binary file
@@ -2,7 +2,7 @@ window.SocialShareButton =
2
2
  openUrl : (url) ->
3
3
  window.open(url)
4
4
  false
5
-
5
+
6
6
  share : (el) ->
7
7
  site = $(el).data('site')
8
8
  title = encodeURIComponent($(el).parent().data('title'))
@@ -19,4 +19,14 @@ window.SocialShareButton =
19
19
  SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{url}")
20
20
  when "qq"
21
21
  SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}")
22
+ when "tqq"
23
+ SocialShareButton.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}")
24
+ when "baidu"
25
+ SocialShareButton.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=")
26
+ when "kaixin001"
27
+ SocialShareButton.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}")
28
+ when "renren"
29
+ SocialShareButton.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=")
30
+ when "google_plus"
31
+ SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
22
32
  false
@@ -2,9 +2,18 @@
2
2
 
3
3
  Creating a sprite from following images:
4
4
 
5
+ lib/assets/images/sprites/social-share-button/baidu.png (16x16)
6
+ lib/assets/images/sprites/social-share-button/delicious.png (16x16)
5
7
  lib/assets/images/sprites/social-share-button/douban.png (16x16)
8
+ lib/assets/images/sprites/social-share-button/email.png (16x16)
6
9
  lib/assets/images/sprites/social-share-button/facebook.png (16x16)
10
+ lib/assets/images/sprites/social-share-button/flickr.png (16x16)
11
+ lib/assets/images/sprites/social-share-button/google.png (16x16)
12
+ lib/assets/images/sprites/social-share-button/google_plus.png (16x16)
13
+ lib/assets/images/sprites/social-share-button/kaixin001.png (16x16)
7
14
  lib/assets/images/sprites/social-share-button/qq.png (16x16)
15
+ lib/assets/images/sprites/social-share-button/renren.png (16x16)
16
+ lib/assets/images/sprites/social-share-button/tqq.png (16x16)
8
17
  lib/assets/images/sprites/social-share-button/twitter.png (16x16)
9
18
  lib/assets/images/sprites/social-share-button/weibo.png (16x16)
10
19
 
@@ -13,12 +22,21 @@
13
22
  lib/assets/stylesheets/social-share-button.scss
14
23
 
15
24
  Output size:
16
- 48x32
25
+ 64x64
17
26
 
18
27
 
19
28
  */
20
- .social-share-button-douban { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px 0px no-repeat }
21
- .social-share-button-facebook { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px 0px no-repeat }
22
- .social-share-button-qq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -16px no-repeat }
23
- .social-share-button-twitter { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -16px no-repeat }
24
- .social-share-button-weibo { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px 0px no-repeat }
29
+ .social-share-button-baidu { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px 0px no-repeat }
30
+ .social-share-button-delicious { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px 0px no-repeat }
31
+ .social-share-button-douban { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -16px no-repeat }
32
+ .social-share-button-email { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -16px no-repeat }
33
+ .social-share-button-facebook { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px 0px no-repeat }
34
+ .social-share-button-flickr { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px -16px no-repeat }
35
+ .social-share-button-google { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -32px no-repeat }
36
+ .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 }
37
+ .social-share-button-kaixin001 { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -32px -32px no-repeat }
38
+ .social-share-button-qq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px 0px no-repeat }
39
+ .social-share-button-renren { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px -16px no-repeat }
40
+ .social-share-button-tqq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -48px -32px no-repeat }
41
+ .social-share-button-twitter { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) 0px -48px no-repeat }
42
+ .social-share-button-weibo { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/social-share-button.png')) -16px -48px no-repeat }
@@ -1,3 +1,3 @@
1
1
  SocialShareButton.configure do |config|
2
- config.allow_sites = %w(twitter facebook weibo douban qq)
2
+ config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu)
3
3
  end
@@ -1,9 +1,14 @@
1
1
  en:
2
2
  social_share_button:
3
- share_to: Share to
3
+ share_to: Share to %{name}
4
4
  weibo: Sina Weibo
5
5
  twitter: Twitter
6
6
  facebook: Facebook
7
7
  douban: Douban
8
- qq: QQ
9
-
8
+ qq: Qzone
9
+ tqq: Tqq
10
+ delicious: Delicious
11
+ baidu: Baidu.com
12
+ kaixin001: Kaixin001.com
13
+ renren: Renren.com
14
+ google_plus: Google+
@@ -1,8 +1,14 @@
1
1
  'zh-CN':
2
2
  social_share_button:
3
- share_to: 分享到
3
+ share_to: 分享到%{name}
4
4
  weibo: 新浪微博
5
5
  twitter: Twitter
6
6
  facebook: Facebook
7
7
  douban: 豆瓣
8
- qq: QQ空间
8
+ qq: QQ空间
9
+ tqq: 腾讯微博
10
+ delicious: Delicious
11
+ baidu: 百度收藏
12
+ kaixin001: 开心网
13
+ renren: 人人网
14
+ google_plus: Google+
@@ -1,8 +1,14 @@
1
1
  'zh-TW':
2
2
  social_share_button:
3
- share_to: 分享到
3
+ share_to: 分享到%{name}
4
4
  weibo: 新浪微博
5
5
  twitter: Twitter
6
6
  facebook: Facebook
7
7
  douban: 豆瓣
8
- qq: QQ空間
8
+ qq: QQ空間
9
+ tqq: 腾讯微博
10
+ delicious: Delicious
11
+ baidu: 百度收藏
12
+ kaixin001: 開心網
13
+ renren: 人人網
14
+ google_plus: Google+
@@ -15,8 +15,4 @@ module SocialShareButton
15
15
  def initialize
16
16
  end
17
17
  end
18
- end
19
-
20
- SocialShareButton.configure do |conf|
21
- conf.allow_sites = %w(twitter facebook weibo douban qq)
22
18
  end
@@ -7,7 +7,7 @@ module SocialShareButton
7
7
  html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}'>"
8
8
 
9
9
  SocialShareButton.config.allow_sites.each do |name|
10
- link_title = [t("social_share_button.share_to"),t("social_share_button.#{name.downcase}")].join("")
10
+ link_title = t "social_share_button.share_to", :name => t("social_share_button.#{name.downcase}")
11
11
  html << link_to("","#", :rel => "nofollow #{rel}",
12
12
  "data-site" => name,
13
13
  :class => "social-share-button-#{name}",
@@ -1,3 +1,3 @@
1
1
  module SocialShareButton
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/psd/icon_templet.psd CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social-share-button
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-22 00:00:00.000000000 Z
12
+ date: 2012-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70134693282500 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70134693282500
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  description: Helper for add social share feature in your Rails app. Twitter, Facebook,
26
31
  Weibo, Douban, QQ ...
27
32
  email:
@@ -34,14 +39,24 @@ files:
34
39
  - .gitignore
35
40
  - Changelogs.md
36
41
  - Gemfile
37
- - README.markdown
42
+ - README.md
38
43
  - Rakefile
39
44
  - lib/assets/images/.DS_Store
45
+ - lib/assets/images/sprites/.DS_Store
40
46
  - lib/assets/images/sprites/social-share-button.png
41
47
  - lib/assets/images/sprites/social-share-button/.DS_Store
48
+ - lib/assets/images/sprites/social-share-button/baidu.png
49
+ - lib/assets/images/sprites/social-share-button/delicious.png
42
50
  - lib/assets/images/sprites/social-share-button/douban.png
51
+ - lib/assets/images/sprites/social-share-button/email.png
43
52
  - lib/assets/images/sprites/social-share-button/facebook.png
53
+ - lib/assets/images/sprites/social-share-button/flickr.png
54
+ - lib/assets/images/sprites/social-share-button/google.png
55
+ - lib/assets/images/sprites/social-share-button/google_plus.png
56
+ - lib/assets/images/sprites/social-share-button/kaixin001.png
44
57
  - lib/assets/images/sprites/social-share-button/qq.png
58
+ - lib/assets/images/sprites/social-share-button/renren.png
59
+ - lib/assets/images/sprites/social-share-button/tqq.png
45
60
  - lib/assets/images/sprites/social-share-button/twitter.png
46
61
  - lib/assets/images/sprites/social-share-button/weibo.png
47
62
  - lib/assets/javascripts/social-share-button.coffee
@@ -80,9 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
95
  version: '0'
81
96
  requirements: []
82
97
  rubyforge_project:
83
- rubygems_version: 1.8.11
98
+ rubygems_version: 1.8.24
84
99
  signing_key:
85
100
  specification_version: 3
86
101
  summary: Helper for add social share feature in your Rails app. Twitter, Facebook,
87
102
  Weibo, Douban, QQ ...
88
103
  test_files: []
104
+ has_rdoc:
data/README.markdown DELETED
@@ -1,50 +0,0 @@
1
- # Social Share Button
2
-
3
- This is a gem to helper you quick create a share feature in you Rails apps.
4
-
5
- ## Screenshot
6
-
7
- ![img](http://l.ruby-china.org/photo/00cc56853b29b5d90458d39e855a936d.png)
8
-
9
- ## Install
10
-
11
- in your `Gemfile`:
12
-
13
- gem 'social_share_button'
14
-
15
- an install it:
16
-
17
- $ bundle install
18
- $ rails generate social_share_button:install
19
-
20
- ## Configure
21
-
22
- you can create this content in `config/initializes/social_share_button.rb`:
23
-
24
- SocialShareButton.configure do |config|
25
- config.allow_sites = %w(twitter facebook weibo douban)
26
- end
27
-
28
- ## Usage
29
-
30
- you need add require css,js file in your app assets files:
31
-
32
- `app/assets/javascripts/application.js`
33
-
34
- //= require social-share-button
35
-
36
- `app/assets/stylesheets/application.css`
37
-
38
- *= require social-share-button
39
-
40
- then you can use `social_share_button_tag` helper in views, for example `app/views/posts/show.html.erb`
41
-
42
- <%= social_share_button_tag(@post.title) %>
43
-
44
- and you can custom rel attribute:
45
-
46
- <%= social_share_button_tag(@post.title, :rel => "twipsy") %>
47
-
48
- ## Demo
49
-
50
- [http://ruby-china.org/wiki/about](http://ruby-china.org/wiki/about)