social-share-button 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .DS_Store
1
2
  *.gem
2
3
  .bundle
3
4
  Gemfile.lock
@@ -1,3 +1,7 @@
1
+ == 0.0.9
2
+
3
+ * Allow to give :url option to custom url.
4
+
1
5
  == 0.0.8
2
6
 
3
7
  * Add Google Bookmark;
data/README.md CHANGED
@@ -73,6 +73,12 @@ And you can custom rel attribute:
73
73
  <%= social_share_button_tag(@post.title, :rel => "twipsy") %>
74
74
  ```
75
75
 
76
+ You can also specify the URL that it links to:
77
+
78
+ ```erb
79
+ <%= social_share_button_tag(@post.title, :url => "http://myapp.com/foo/bar") %>
80
+ ```
81
+
76
82
  ## Demo
77
83
 
78
84
  [http://ruby-china.org/wiki/about](http://ruby-china.org/wiki/about)
@@ -7,7 +7,9 @@ window.SocialShareButton =
7
7
  site = $(el).data('site')
8
8
  title = encodeURIComponent($(el).parent().data('title'))
9
9
  img = encodeURIComponent($(el).parent().data("img"))
10
- url = encodeURIComponent(location.href)
10
+ url = encodeURIComponent($(el).parent().data("url"))
11
+ if url.length == 0
12
+ url = encodeURIComponent(location.href)
11
13
  switch site
12
14
  when "weibo"
13
15
  SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
@@ -31,4 +33,4 @@ window.SocialShareButton =
31
33
  SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
32
34
  when "google_bookmark"
33
35
  SocialShareButton.openUrl("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=#{url}&title=#{title}")
34
- false
36
+ false
@@ -4,7 +4,7 @@ module SocialShareButton
4
4
  def social_share_button_tag(title = "", opts = {})
5
5
  rel = opts[:rel]
6
6
  html = []
7
- html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}'>"
7
+ html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}' data-url='#{opts[:url]}'>"
8
8
 
9
9
  SocialShareButton.config.allow_sites.each do |name|
10
10
  link_title = t "social_share_button.share_to", :name => t("social_share_button.#{name.downcase}")
@@ -18,4 +18,4 @@ module SocialShareButton
18
18
  raw html.join("\n")
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module SocialShareButton
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-10 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
+ prerelease: false
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
+ none: false
22
23
  type: :development
23
- prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
29
+ none: false
30
30
  description: Helper for add social share feature in your Rails app. Twitter, Facebook,
31
31
  Weibo, Douban, QQ ...
32
32
  email:
@@ -81,23 +81,17 @@ rdoc_options: []
81
81
  require_paths:
82
82
  - lib
83
83
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
84
  requirements:
86
85
  - - ! '>='
87
86
  - !ruby/object:Gem::Version
88
87
  version: '0'
89
- segments:
90
- - 0
91
- hash: -1453195967359969640
92
- required_rubygems_version: !ruby/object:Gem::Requirement
93
88
  none: false
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
90
  requirements:
95
91
  - - ! '>='
96
92
  - !ruby/object:Gem::Version
97
93
  version: '0'
98
- segments:
99
- - 0
100
- hash: -1453195967359969640
94
+ none: false
101
95
  requirements: []
102
96
  rubyforge_project:
103
97
  rubygems_version: 1.8.24