daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <% fb_connect_async_js do %>
  2.     <% unless current_facebook_user %>
  3.         FB.login(function(response) {
  4.             if (response.session) {
  5.                 // window.location.href = '#{request.url}';
  6.                 window.location.href = '<%= root_url %>';
  7.             } else {
  8.                 // user cancelled login
  9.             }
  10.         }, {perms:'read_stream,offline_access,email,user_status,user_interests,user_location,user_online_presence'});
  11.     <% end %>
  12. <% end %>
  13.  
  14.  
  15. <% if current_facebook_user %>
  16.    
  17.     <%= debug @user.friends %> <!-- in controller: @user = current_facebook_user.fetch -->
  18.   <%= "Welcome #{@user.name}!" %>
  19.     <%= fb_profile_pic(current_facebook_user) %>
  20.   <%= fb_logout_link("Logout of fb", request.url) %><br />
  21.  
  22.     <table><!-- list friends -->
  23.         <% for friend in @user.friends do %>
  24.             <tr><td><%= fb_profile_pic(friend.id) %></td><td><%= friend.name %></td></tr>
  25.         <% end %>
  26.     </table>
  27.    
  28. <% else %>
  29.     <h1>app not authorized.</h1>
  30.   <%= fb_login_and_redirect('#{ root_url }', :perms => 'read_stream,offline_access,email,user_status,user_interests,user_location,user_online_presence') %>
  31. <% end %>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top