Module: DeviseFacebookOpenGraph::Rails::ViewHelpers

Defined in:
lib/devise_facebook_open_graph/rails/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#facebook_init_javascript_sdkObject

Inserts facebook HTML and javascript tag for initializing JavaScript SDK. See developers.facebook.com/docs/authentication/: Single Sign-on.

Some options to this helper-method might be added in the future :-)



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/devise_facebook_open_graph/rails/view_helpers.rb', line 12

def facebook_init_javascript_sdk
  buffer =  :div, '', :id => 'fb-root'
  buffer << javascript_include_tag(DeviseFacebookOpenGraph::Facebook::Config.sdk_java_script_source)

  buffer << javascript_tag(<<-JAVASCRIPT)
    FB.init({
      appId: '#{DeviseFacebookOpenGraph::Facebook::Config.application_id}',
      status: true,
      cookie: true,
      xfbml: true
    });
  JAVASCRIPT

  buffer.html_safe
end