loyal_share_buttons 1.0.0

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.
Files changed (41) hide show
  1. data/.gitignore +78 -0
  2. data/Gemfile +6 -0
  3. data/Gemfile.lock +95 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +71 -0
  6. data/Rakefile +40 -0
  7. data/lib/assets/images/.gitkeep +0 -0
  8. data/lib/assets/images/sprites/.DS_Store +0 -0
  9. data/lib/assets/images/sprites/loyal_share_buttons.png +0 -0
  10. data/lib/assets/images/sprites/loyal_share_buttons/.DS_Store +0 -0
  11. data/lib/assets/images/sprites/loyal_share_buttons/baidu.png +0 -0
  12. data/lib/assets/images/sprites/loyal_share_buttons/delicious.png +0 -0
  13. data/lib/assets/images/sprites/loyal_share_buttons/douban.png +0 -0
  14. data/lib/assets/images/sprites/loyal_share_buttons/email.png +0 -0
  15. data/lib/assets/images/sprites/loyal_share_buttons/facebook.png +0 -0
  16. data/lib/assets/images/sprites/loyal_share_buttons/flickr.png +0 -0
  17. data/lib/assets/images/sprites/loyal_share_buttons/google_bookmark.png +0 -0
  18. data/lib/assets/images/sprites/loyal_share_buttons/google_plus.png +0 -0
  19. data/lib/assets/images/sprites/loyal_share_buttons/kaixin001.png +0 -0
  20. data/lib/assets/images/sprites/loyal_share_buttons/qq.png +0 -0
  21. data/lib/assets/images/sprites/loyal_share_buttons/renren.png +0 -0
  22. data/lib/assets/images/sprites/loyal_share_buttons/tqq.png +0 -0
  23. data/lib/assets/images/sprites/loyal_share_buttons/twitter.png +0 -0
  24. data/lib/assets/images/sprites/loyal_share_buttons/weibo.png +0 -0
  25. data/lib/assets/javascripts/.gitkeep +0 -0
  26. data/lib/assets/javascripts/loyal_share_buttons.js.coffee +34 -0
  27. data/lib/assets/styleshees/.gitkeep +0 -0
  28. data/lib/assets/styleshees/loyal_share_buttons.scss +47 -0
  29. data/lib/generators/loyal_share_buttons/install_generator.rb +12 -0
  30. data/lib/generators/loyal_share_buttons/templates/config/initializers/loyal_share_buttons.rb +3 -0
  31. data/lib/generators/loyal_share_buttons/templates/config/locales/en/views/loyal_share_buttons.en.yml +16 -0
  32. data/lib/generators/loyal_share_buttons/templates/config/locales/zh_cn/views/loyal_share_buttons.zh_cn.yml +16 -0
  33. data/lib/loyal_share_buttons.rb +17 -0
  34. data/lib/loyal_share_buttons/config.rb +18 -0
  35. data/lib/loyal_share_buttons/engine.rb +5 -0
  36. data/lib/loyal_share_buttons/helper.rb +23 -0
  37. data/lib/loyal_share_buttons/railtie.rb +7 -0
  38. data/lib/loyal_share_buttons/version.rb +3 -0
  39. data/lib/tasks/loyal_share_buttons_tasks.rake +4 -0
  40. data/loyal_share_buttons.gemspec +23 -0
  41. metadata +103 -0
@@ -0,0 +1,78 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/
7
+ test/dummy/.sass-cache
8
+
9
+ /*.gem
10
+
11
+ *~
12
+
13
+ /config/database.yml
14
+ /config/resque.yml
15
+ /config/deploy.rb
16
+ /assets
17
+
18
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
19
+ #
20
+ # If you find yourself ignoring temporary files generated by your text editor
21
+ # or operating system, you probably want to add a global ignore instead:
22
+ # git config --global core.excludesfile ~/.gitignore_global
23
+
24
+ # Ignore bundler config
25
+ /.idea
26
+ /.bundle
27
+ /.project
28
+ /index
29
+ /.rvmrc
30
+
31
+ # Ignore the default SQLite database.
32
+ /db/sqlites/*.sqlite3
33
+ /db/sqlites/*.sqlite3-journal
34
+ /db/backups
35
+ /db/*.sql
36
+
37
+ # Ignore all logfiles and tempfiles.
38
+ /log/*.log
39
+ /tmp
40
+ /db/schema.rb
41
+
42
+ /nbproject
43
+
44
+ /.sass-cache/
45
+ /public/uploads/
46
+ /public/assets/
47
+ /uploads/*
48
+
49
+ # **.lock
50
+ **.swp
51
+
52
+ /log/*.pid
53
+ /log/*.out
54
+
55
+ /tags
56
+
57
+
58
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
59
+ #
60
+ # If you find yourself ignoring temporary files generated by your text editor
61
+ # or operating system, you probably want to add a global ignore instead:
62
+ # git config --global core.excludesfile ~/.gitignore_global
63
+
64
+ # Ignore bundler config
65
+
66
+ #/.bundle
67
+
68
+ # Ignore the default SQLite database.
69
+ #/db/*.sqlite3
70
+
71
+ # Ignore all logfiles and tempfiles.
72
+ #/log/*.log
73
+ #/tmp
74
+
75
+
76
+ config/settings.local.yml
77
+ config/settings/*.local.yml
78
+ config/environments/*.local.yml
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in social-share.gemspec
4
+ gemspec
5
+
6
+ gem "sprite-factory", "1.4.1"
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ loyal_share_buttons (0.0.1)
5
+ rails (~> 3.2.8)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.8)
11
+ actionpack (= 3.2.8)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.8)
14
+ activemodel (= 3.2.8)
15
+ activesupport (= 3.2.8)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.3)
23
+ activemodel (3.2.8)
24
+ activesupport (= 3.2.8)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.8)
27
+ activemodel (= 3.2.8)
28
+ activesupport (= 3.2.8)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.8)
32
+ activemodel (= 3.2.8)
33
+ activesupport (= 3.2.8)
34
+ activesupport (3.2.8)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.2)
38
+ builder (3.0.4)
39
+ erubis (2.7.0)
40
+ hike (1.2.1)
41
+ i18n (0.6.1)
42
+ journey (1.0.4)
43
+ json (1.7.5)
44
+ mail (2.4.4)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.19)
49
+ multi_json (1.3.6)
50
+ polyglot (0.3.3)
51
+ rack (1.4.1)
52
+ rack-cache (1.2)
53
+ rack (>= 0.4)
54
+ rack-ssl (1.3.2)
55
+ rack
56
+ rack-test (0.6.2)
57
+ rack (>= 1.0)
58
+ rails (3.2.8)
59
+ actionmailer (= 3.2.8)
60
+ actionpack (= 3.2.8)
61
+ activerecord (= 3.2.8)
62
+ activeresource (= 3.2.8)
63
+ activesupport (= 3.2.8)
64
+ bundler (~> 1.0)
65
+ railties (= 3.2.8)
66
+ railties (3.2.8)
67
+ actionpack (= 3.2.8)
68
+ activesupport (= 3.2.8)
69
+ rack-ssl (~> 1.3.2)
70
+ rake (>= 0.8.7)
71
+ rdoc (~> 3.4)
72
+ thor (>= 0.14.6, < 2.0)
73
+ rake (0.9.2.2)
74
+ rdoc (3.12)
75
+ json (~> 1.4)
76
+ sprite-factory (1.4.1)
77
+ sprockets (2.1.3)
78
+ hike (~> 1.2)
79
+ rack (~> 1.0)
80
+ tilt (~> 1.1, != 1.3.0)
81
+ sqlite3 (1.3.6)
82
+ thor (0.16.0)
83
+ tilt (1.3.3)
84
+ treetop (1.4.11)
85
+ polyglot
86
+ polyglot (>= 0.3.1)
87
+ tzinfo (0.3.33)
88
+
89
+ PLATFORMS
90
+ ruby
91
+
92
+ DEPENDENCIES
93
+ loyal_share_buttons!
94
+ sprite-factory (= 1.4.1)
95
+ sqlite3
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,71 @@
1
+ # Loyal Share Buttons
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
+ * Google Bookmark
18
+
19
+ ## Install
20
+
21
+ In your `Gemfile`:
22
+
23
+ ```ruby
24
+ gem 'loyal_share_buttons'
25
+ ```
26
+
27
+ And install it:
28
+
29
+ ```bash
30
+ $ bundle install
31
+ $ rails generate loyal_share_buttons.install
32
+ ```
33
+
34
+ ## Configure
35
+
36
+ You can config `config/initializes/loyal_share_buttons.rb` to choose which site do you want to use:
37
+
38
+ ```ruby
39
+ LoyalShareButtons.configure do |config|
40
+ config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu)
41
+ end
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ You need add require css,js file in your app assets files:
47
+
48
+ `app/assets/javascripts/application.coffee`
49
+
50
+ ```
51
+ #= require loyal_share_buttons
52
+ ```
53
+
54
+ `app/assets/stylesheets/application.scss`
55
+
56
+ ```
57
+ *= require loyal_share_buttons
58
+ ```
59
+
60
+ Then you can use `loyal_share_buttons_tag` helper in views, for example `app/views/posts/show.html.erb`
61
+
62
+ ```erb
63
+ <%= loyal_share_buttons_tag(@post.title) %>
64
+ ```
65
+
66
+ And you can custom rel attribute:
67
+
68
+ ```erb
69
+ <%= loyal_share_buttons_tag(@post.title, :rel => "twipsy") %>
70
+ ```
71
+
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'LoyalShareButtons'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
File without changes
File without changes
@@ -0,0 +1,34 @@
1
+ window.LoyalShareButtons =
2
+ openUrl : (url) ->
3
+ window.open(url)
4
+ false
5
+
6
+ share : (el) ->
7
+ site = $(el).data('site')
8
+ title = encodeURIComponent($(el).parent().data('title'))
9
+ img = encodeURIComponent($(el).parent().data("img"))
10
+ url = encodeURIComponent(location.href)
11
+ switch site
12
+ when "weibo"
13
+ LoyalShareButtons.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
14
+ when "twitter"
15
+ LoyalShareButtons.openUrl("https://twitter.com/home?status=#{title}: #{url}")
16
+ when "douban"
17
+ LoyalShareButtons.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
18
+ when "facebook"
19
+ LoyalShareButtons.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{url}")
20
+ when "qq"
21
+ LoyalShareButtons.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
22
+ when "tqq"
23
+ LoyalShareButtons.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}&pic=#{img}")
24
+ when "baidu"
25
+ LoyalShareButtons.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=")
26
+ when "kaixin001"
27
+ LoyalShareButtons.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}")
28
+ when "renren"
29
+ LoyalShareButtons.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=")
30
+ when "google_plus"
31
+ LoyalShareButtons.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
32
+ when "google_bookmark"
33
+ LoyalShareButtons.openUrl("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=#{url}&title=#{title}")
34
+ false
File without changes
@@ -0,0 +1,47 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ lib/assets/images/sprites/loyal_share_buttons/baidu.png (16x16)
6
+ lib/assets/images/sprites/loyal_share_buttons/delicious.png (16x16)
7
+ lib/assets/images/sprites/loyal_share_buttons/douban.png (16x16)
8
+ lib/assets/images/sprites/loyal_share_buttons/email.png (16x16)
9
+ lib/assets/images/sprites/loyal_share_buttons/facebook.png (16x16)
10
+ lib/assets/images/sprites/loyal_share_buttons/flickr.png (16x16)
11
+ lib/assets/images/sprites/loyal_share_buttons/google_bookmark.png (16x16)
12
+ lib/assets/images/sprites/loyal_share_buttons/google_plus.png (16x16)
13
+ lib/assets/images/sprites/loyal_share_buttons/kaixin001.png (16x16)
14
+ lib/assets/images/sprites/loyal_share_buttons/qq.png (16x16)
15
+ lib/assets/images/sprites/loyal_share_buttons/renren.png (16x16)
16
+ lib/assets/images/sprites/loyal_share_buttons/tqq.png (16x16)
17
+ lib/assets/images/sprites/loyal_share_buttons/twitter.png (16x16)
18
+ lib/assets/images/sprites/loyal_share_buttons/weibo.png (16x16)
19
+
20
+ Output files:
21
+ lib/assets/images/sprites/loyal_share_buttons.png
22
+ lib/assets/stylesheets/loyal_share_buttons.scss
23
+
24
+ Output size:
25
+ 64x64
26
+
27
+ */
28
+
29
+ .loyal_share_buttons {
30
+ a {
31
+ padding: 0 !important;
32
+ }
33
+ }
34
+ .loyal_share_buttons-baidu { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) 0px 0px no-repeat }
35
+ .loyal_share_buttons-delicious { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -16px 0px no-repeat }
36
+ .loyal_share_buttons-douban { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) 0px -16px no-repeat }
37
+ .loyal_share_buttons-email { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -16px -16px no-repeat }
38
+ .loyal_share_buttons-facebook { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -32px 0px no-repeat }
39
+ .loyal_share_buttons-flickr { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -32px -16px no-repeat }
40
+ .loyal_share_buttons-google_bookmark { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) 0px -32px no-repeat }
41
+ .loyal_share_buttons-google_plus { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -16px -32px no-repeat }
42
+ .loyal_share_buttons-kaixin001 { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -32px -32px no-repeat }
43
+ .loyal_share_buttons-qq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -48px 0px no-repeat }
44
+ .loyal_share_buttons-renren { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -48px -16px no-repeat }
45
+ .loyal_share_buttons-tqq { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -48px -32px no-repeat }
46
+ .loyal_share_buttons-twitter { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) 0px -48px no-repeat }
47
+ .loyal_share_buttons-weibo { display:inline-block; width: 16px; height: 16px; background: url(image-path('sprites/loyal_share_buttons.png')) -16px -48px no-repeat }
@@ -0,0 +1,12 @@
1
+ module LoyalShareButtons
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ desc "Copy LoyalShareButtons default files"
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def copy_config
8
+ directory 'config'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ LoyalShareButtons.configure do |config|
2
+ config.allow_sites = %w(twitter facebook google_plus weibo douban tqq renren qq kaixin001 baidu google_bookmark)
3
+ end
@@ -0,0 +1,16 @@
1
+ en:
2
+ views:
3
+ loyal_share_buttons:
4
+ share_to: Share to %{name}
5
+ weibo: Sina Weibo
6
+ twitter: Twitter
7
+ facebook: Facebook
8
+ douban: Douban
9
+ qq: Qzone
10
+ tqq: Tqq
11
+ delicious: Delicious
12
+ baidu: Baidu.com
13
+ kaixin001: Kaixin001.com
14
+ renren: Renren.com
15
+ google_plus: Google+
16
+ google_bookmark: Google Bookmark
@@ -0,0 +1,16 @@
1
+ zh_cn:
2
+ views:
3
+ loyal_share_buttons:
4
+ share_to: 分享到%{name}
5
+ weibo: 新浪微博
6
+ twitter: Twitter
7
+ facebook: Facebook
8
+ douban: 豆瓣
9
+ qq: QQ空间
10
+ tqq: 腾讯微博
11
+ delicious: Delicious
12
+ baidu: 百度收藏
13
+ kaixin001: 开心网
14
+ renren: 人人网
15
+ google_plus: Google+
16
+ google_bookmark: Google 收藏
@@ -0,0 +1,17 @@
1
+ require "loyal_share_buttons/version"
2
+ require "loyal_share_buttons/config"
3
+ require "loyal_share_buttons/helper"
4
+
5
+ # I18n.load_path += Dir.glob( File.dirname(__FILE__) + "lib/locales/**/*.{rb,yml}" )
6
+
7
+ module LoyalShareButtons
8
+ module Rails
9
+ if ::Rails.version < "3.1"
10
+ require "loyal_share_buttons/railtie"
11
+ else
12
+ require "loyal_share_buttons/engine"
13
+ end
14
+ end
15
+ end
16
+
17
+ ActionView::Base.send :include, LoyalShareButtons::Helper
@@ -0,0 +1,18 @@
1
+ module LoyalShareButtons
2
+ class << self
3
+ attr_accessor :config
4
+ def configure
5
+ yield self.config ||= Config.new
6
+ end
7
+ end
8
+
9
+ class Config
10
+ # enable social sites to share,
11
+ # * default : twitter facebook weibo douban
12
+ # * site support: twitter facebook weibo douban
13
+ attr_accessor :allow_sites
14
+
15
+ def initialize
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module LoyalShareButtons
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace LoyalShareButtons
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ module LoyalShareButtons
3
+ module Helper
4
+ def loyal_share_buttons_tag(title = "", opts = {})
5
+ rel = opts[:rel]
6
+ html = []
7
+ html << "<div class='loyal_share_buttons' data-title='#{title}' data-img='#{opts[:image]}'>"
8
+
9
+ ::LoyalShareButtons.config.allow_sites.each do |_name|
10
+ _name = _name.downcase
11
+ name = I18n.t("views.loyal_share_buttons.#{_name}")
12
+ link_title = I18n.t "views.loyal_share_buttons.share_to", :name => name
13
+ html << link_to("","javascript:;", :rel => "nofollow #{rel}",
14
+ "data-site" => _name,
15
+ :class => "loyal_share_buttons-#{_name}",
16
+ :onclick => "return LoyalShareButtons.share(this);",
17
+ :title => h(link_title))
18
+ end
19
+ html << "</div>"
20
+ raw html.join("\n")
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+ module LoyalShareButtons
3
+ module Rails
4
+ class Railtie < ::Rails::Railtie
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module LoyalShareButtons
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :loyal_share_buttons do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "loyal_share_buttons/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "loyal_share_buttons"
7
+ s.version = LoyalShareButtons::VERSION
8
+ s.authors = ["happy"]
9
+ s.email = ["ruby800.com@gmail.com"]
10
+ s.homepage = "http://github.com/blogsoso/loyal_share_buttons"
11
+ s.summary = %q{Helper for add social share feature in your Rails app. Twitter, Facebook, Weibo, Douban, QQ ...}
12
+ s.description = %q{Helper for add social share feature in your Rails app. Twitter, Facebook, Weibo, Douban, QQ ...}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ # specify any dependencies here; for example:
20
+ s.files = `git ls-files`.split("\n")
21
+ s.add_development_dependency "rails"
22
+ # s.add_runtime_dependency "rest-client"
23
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: loyal_share_buttons
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - happy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Helper for add social share feature in your Rails app. Twitter, Facebook,
31
+ Weibo, Douban, QQ ...
32
+ email:
33
+ - ruby800.com@gmail.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - Gemfile.lock
41
+ - MIT-LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - lib/assets/images/.gitkeep
45
+ - lib/assets/images/sprites/.DS_Store
46
+ - lib/assets/images/sprites/loyal_share_buttons.png
47
+ - lib/assets/images/sprites/loyal_share_buttons/.DS_Store
48
+ - lib/assets/images/sprites/loyal_share_buttons/baidu.png
49
+ - lib/assets/images/sprites/loyal_share_buttons/delicious.png
50
+ - lib/assets/images/sprites/loyal_share_buttons/douban.png
51
+ - lib/assets/images/sprites/loyal_share_buttons/email.png
52
+ - lib/assets/images/sprites/loyal_share_buttons/facebook.png
53
+ - lib/assets/images/sprites/loyal_share_buttons/flickr.png
54
+ - lib/assets/images/sprites/loyal_share_buttons/google_bookmark.png
55
+ - lib/assets/images/sprites/loyal_share_buttons/google_plus.png
56
+ - lib/assets/images/sprites/loyal_share_buttons/kaixin001.png
57
+ - lib/assets/images/sprites/loyal_share_buttons/qq.png
58
+ - lib/assets/images/sprites/loyal_share_buttons/renren.png
59
+ - lib/assets/images/sprites/loyal_share_buttons/tqq.png
60
+ - lib/assets/images/sprites/loyal_share_buttons/twitter.png
61
+ - lib/assets/images/sprites/loyal_share_buttons/weibo.png
62
+ - lib/assets/javascripts/.gitkeep
63
+ - lib/assets/javascripts/loyal_share_buttons.js.coffee
64
+ - lib/assets/styleshees/.gitkeep
65
+ - lib/assets/styleshees/loyal_share_buttons.scss
66
+ - lib/generators/loyal_share_buttons/install_generator.rb
67
+ - lib/generators/loyal_share_buttons/templates/config/initializers/loyal_share_buttons.rb
68
+ - lib/generators/loyal_share_buttons/templates/config/locales/en/views/loyal_share_buttons.en.yml
69
+ - lib/generators/loyal_share_buttons/templates/config/locales/zh_cn/views/loyal_share_buttons.zh_cn.yml
70
+ - lib/loyal_share_buttons.rb
71
+ - lib/loyal_share_buttons/config.rb
72
+ - lib/loyal_share_buttons/engine.rb
73
+ - lib/loyal_share_buttons/helper.rb
74
+ - lib/loyal_share_buttons/railtie.rb
75
+ - lib/loyal_share_buttons/version.rb
76
+ - lib/tasks/loyal_share_buttons_tasks.rake
77
+ - loyal_share_buttons.gemspec
78
+ homepage: http://github.com/blogsoso/loyal_share_buttons
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 1.8.24
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Helper for add social share feature in your Rails app. Twitter, Facebook,
102
+ Weibo, Douban, QQ ...
103
+ test_files: []