Module: FacebookApp::FacebookSdkHelper
- Defined in:
- app/helpers/facebook_app/facebook_sdk_helper.rb
Instance Method Summary collapse
- #add_facebook_sdk ⇒ Object
- #comments_box ⇒ Object
- #facebook_login(text, permissions, log_in_url) ⇒ Object
- #facebook_logout_button ⇒ Object
- #uid ⇒ Object
- #uninstall_facebook_app_button ⇒ Object
Instance Method Details
#add_facebook_sdk ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 4 def add_facebook_sdk %Q{ <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : '#{FacebookApp::FacebookCredentials.app_id}', channelURL : '#{facebook_app.facebook_channel_url}', status : true, // check login status cookie : true, // enable cookies to allow the server to access the session oauth : true, // enable OAuth 2.0 xfbml : true // parse XFBML }); // Additional initialization code here }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script> }.html_safe end |
#comments_box ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 49 def comments_box %Q{ <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=225198020866871"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-comments" data-href="http://apps.facebook.com/myprofilereport/" data-num-posts="20" data-width="700"></div> }.html_safe end |
#facebook_login(text, permissions, log_in_url) ⇒ Object
35 36 37 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 35 def facebook_login(text, , log_in_url) link_to(text, "#", :onclick => "facebookLogin('#{}', '#{log_in_url}', 'http://www.identified.com/?fbg=1'").html_safe end |
#facebook_logout_button ⇒ Object
45 46 47 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 45 def ("Log out of App", "FB.logout()") end |
#uid ⇒ Object
31 32 33 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 31 def uid javascript_tag("FB.getUserID()") end |
#uninstall_facebook_app_button ⇒ Object
39 40 41 42 43 |
# File 'app/helpers/facebook_app/facebook_sdk_helper.rb', line 39 def # hackish fix for route since engine in Rails 3.1 tries to double up # the initial backslash ("Uninstall App", "removeAppPermissions()") end |