Module: SocialButtons::Like

Includes:
Assistant
Defined in:
lib/social_buttons/view_helpers/like.rb

Defined Under Namespace

Classes: Scripter

Constant Summary collapse

CLASS =
"fb-like"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_optionsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/social_buttons/view_helpers/like.rb', line 21

def default_options
  @default_options ||= {
    send:    "false",
    layout:  "button_count",
    width:   "450",
    action:  "like",
    font:    "arial",
    colorscheme: "light"
  }.merge("show-faces" => "false")
end

Instance Method Details

#like_button(app_id, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/social_buttons/view_helpers/like.rb', line 7

def like_button(app_id, options = {})
  clazz = SocialButtons::Like
  params = clazz.options_to_data_params(clazz.default_options.merge(options))
  params.merge!(class: CLASS)

  html = "".html_safe
  html << (:div, nil, id: "fb-root")
  html << clazz::Scripter.new(self).script(app_id, options)
  html << (:div, nil, params)
  html
end