google_plus_helper 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/google_plus_helper/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["chitsaou"]
6
- gem.email = ["chitsaou@techbang.com.tw"]
5
+ gem.authors = ["chitsaou", "v1nc3ntlaw"]
6
+ gem.email = ["chitsaou@techbang.com.tw", "v1nc3ntlaw@techbang.com.tw"]
7
7
  gem.description = %q{Google+ Social Plugins Helpers for Rails}
8
8
  gem.summary = %q{Easily generate Google+ Social Plugins in Rails application}
9
9
  gem.homepage = "https://github.com/techbang/google_plus_helper"
@@ -1,10 +1,10 @@
1
1
  require 'google_plus_helper/settings'
2
2
 
3
- module GooglePlusHelper
3
+ module GooglePlusHelper #:nodoc: all
4
4
  class << self
5
5
  def settings
6
- _settings ||= Settings.new
7
- _settings
6
+ @_settings ||= Settings.new
7
+ @_settings
8
8
  end
9
9
  end
10
10
 
@@ -1,6 +1,6 @@
1
1
  require "google_plus_helper/helper"
2
2
 
3
- module GooglePlusHelper
3
+ module GooglePlusHelper #:nodoc: all
4
4
  class Engine < ::Rails::Engine
5
5
  initializer "google_plus_helper.view_helpers" do
6
6
  ActionView::Base.send :include, GooglePlusHelper
@@ -1,8 +1,26 @@
1
- # https://developers.google.com/+/
2
- # Currently there is no support for generating Schema.org meta tags.
3
- # Please use Open Graph tags.
1
+ # GooglePlusHelper helps you generate Google Plus Social Plugins in your Rails application.
2
+ #
3
+ # See README.md for usage.
4
+ #
5
+ # By default it renders HTML5 version. To switch to XML version, specify the version explicitly in initializer:
6
+ #
7
+ # # config/initializers/google_plus_helper.rb
8
+ # GooglePlusHelper.config do |config|
9
+ # config.social_plugin_version = :xml
10
+ # end
4
11
  module GooglePlusHelper
5
- # load google plusone javascript
12
+ # Generates a <tt><script></tt> tag to load Google Plusone JavaScript file.
13
+ #
14
+ # The trivial usage is to load synchonously:
15
+ # <%= google_plusone_javascript_include_tag %> #=> <script src="..."></script>
16
+ #
17
+ # To load the script asynchronously, use:
18
+ # <%= google_plusone_javascript_include_tag(:async => true)
19
+ #
20
+ # By default it takes "en-US" as display language. Add <tt>:lang</tt> option to change,
21
+ # e.g. <tt> :lang => "zh-TW"</tt>
22
+ #
23
+ # To load in explicit mode, add <tt>:explicit => true</tt> option.
6
24
  def google_plusone_javascript_include_tag(*args)
7
25
  options = {
8
26
  :async => false,
@@ -32,7 +50,9 @@ module GooglePlusHelper
32
50
  end
33
51
  end
34
52
 
35
- def google_social_plugin(plugin_name, options, html_options={})
53
+ # Generates Google+ Social Plugin html structure.
54
+ #
55
+ def google_social_plugin(plugin_name, options, html_options={}) #:nodoc:
36
56
  case GooglePlusHelper.settings.social_plugin_version
37
57
  when :html5
38
58
  html_options.merge! :class => "g-#{plugin_name.to_s}", :data => options
@@ -45,11 +65,16 @@ module GooglePlusHelper
45
65
  end
46
66
  end
47
67
 
48
- # google_plusone_button generates plusone button for specific URL
68
+ # Generates the +1 button for specific URL.
69
+ #
70
+ # Arguments:
49
71
  #
50
- # default arguments: (implicitly assigned according to +1 button document)
51
- # size: standard
52
- # annotation: bubble
72
+ # * <tt>url</tt>: the URL to +1.
73
+ # * <tt>options</tt>: (optional) a hash that is identical to the +1 Button attributes listed here[https://developers.google.com/+/plugins/+1button/#plusonetag-parameters].
74
+ #
75
+ # Example - A +1 button in medium size and without annotation:
76
+ #
77
+ # <%= google_plusone_button("http://example.com", :size => :medium, :annotation => :none)
53
78
  def google_plusone_button(url, *args)
54
79
  options = args.extract_options!
55
80
  options[:href] = url
@@ -58,6 +83,16 @@ module GooglePlusHelper
58
83
  google_social_plugin(:plusone, options, html_options)
59
84
  end
60
85
 
86
+ # Generates the "Share on Google+" button for specific URL.
87
+ #
88
+ # Arguments:
89
+ #
90
+ # * <tt>url</tt>: the URL to +1.
91
+ # * <tt>options</tt>: (optional) a hash that is identical to the Share Button attributes listed here[https://developers.google.com/+/plugins/share/#sharetag-parameters].
92
+ #
93
+ # Example - A Share button aligned to right and with vertical-bubble annotation:
94
+ #
95
+ # <%= google_share_button("http://example.com", :align => :right, :annotation => "vertical-bubble")
61
96
  def google_share_button(url, *args)
62
97
  options = args.extract_options!
63
98
  options.merge! :href => url, :action => :share
@@ -1,6 +1,6 @@
1
1
  require "google_plus_helper/helper"
2
2
 
3
- module GooglePlusHelper
3
+ module GooglePlusHelper #:nodoc: all
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "google_plus_helper.view_helpers" do
6
6
  ActionView::Base.send :include, GooglePlusHelper
@@ -1,4 +1,4 @@
1
- module GooglePlusHelper
1
+ module GooglePlusHelper #:nodoc: all
2
2
  class Settings
3
3
  attr_accessor :social_plugin_version
4
4
 
@@ -1,3 +1,3 @@
1
- module GooglePlusHelper
2
- VERSION = "0.0.2"
1
+ module GooglePlusHelper #:nodoc: all
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_plus_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - chitsaou
9
+ - v1nc3ntlaw
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -13,7 +14,7 @@ date: 2012-05-02 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rails
16
- requirement: &2160571500 !ruby/object:Gem::Requirement
17
+ requirement: &2156424520 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
@@ -21,10 +22,11 @@ dependencies:
21
22
  version: '3.0'
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *2160571500
25
+ version_requirements: *2156424520
25
26
  description: Google+ Social Plugins Helpers for Rails
26
27
  email:
27
28
  - chitsaou@techbang.com.tw
29
+ - v1nc3ntlaw@techbang.com.tw
28
30
  executables: []
29
31
  extensions: []
30
32
  extra_rdoc_files: []