Module: Facebooker::Rails::Helpers::FbConnect

Included in:
Facebooker::Rails::Helpers
Defined in:
lib/facebooker/rails/helpers/fb_connect.rb

Instance Method Summary collapse

Instance Method Details

#fb_connect_javascript_tagObject



6
7
8
9
10
11
12
# File 'lib/facebooker/rails/helpers/fb_connect.rb', line 6

def fb_connect_javascript_tag
  if request.ssl?
    javascript_include_tag "https://www.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
  else
    javascript_include_tag "http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
  end
end

#fb_login_button(callback = nil) ⇒ Object



28
29
30
# File 'lib/facebooker/rails/helpers/fb_connect.rb', line 28

def (callback=nil)
  ("fb:login-button",nil,(callback.nil? ? {} : {:onlogin=>callback}))
end

#fb_unconnected_friends_countObject



32
33
34
# File 'lib/facebooker/rails/helpers/fb_connect.rb', line 32

def fb_unconnected_friends_count
   "fb:unconnected-friends-count",nil
end

#init_fb_connect(*required_features) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/facebooker/rails/helpers/fb_connect.rb', line 14

def init_fb_connect(*required_features)
  init_string = "FB.Facebook.init('#{Facebooker.api_key}','/xd_receiver.html');"
  unless required_features.blank?
     init_string = <<-FBML
      Element.observe(window,'load', function() {
        FB_RequireFeatures(#{required_features.to_json}, function() {
          #{init_string}
        });
      });
      FBML
  end
  javascript_tag init_string
end