Module: SocialButtons::GooglePlus

Extended by:
Help
Includes:
Assistant
Defined in:
lib/social_buttons/view_helpers/google_plus.rb,
lib/social_buttons/view_helpers/google_plus/help.rb

Defined Under Namespace

Modules: Help Classes: AsyncScripter, Scripter

Constant Summary collapse

CLASS =
"g-plusone"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Help

help

Class Method Details

.default_optionsObject



39
40
41
42
43
# File 'lib/social_buttons/view_helpers/google_plus.rb', line 39

def default_options
  @default_options ||= {
    annotations:    "inline"
  }
end

Instance Method Details

#google_plus_button(*args) ⇒ Object

To NOT output script

= google_button :locale => 'es', script: false


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/social_buttons/view_helpers/google_plus.rb', line 17

def google_plus_button *args
  options = args.extract_options!
  clazz = SocialButtons::GooglePlus
  return clazz.script(options) if args.first == :script

  use_script = options.delete :script
  locale = options.delete(:locale) || options.delete(:lang)

  params = clazz.options_to_data_params(clazz.default_options.merge(options))
  params.merge!(class: CLASS)

  scripter_class = use_script == :async ? clazz::AsyncScripter : clazz::Scripter

  html = "".html_safe
  html << (:div, nil, params)
  html << scripter_class.new(self).script(locale) if use_script
  html
end