Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2011 12:27
Show Gist options
  • Save anonymous/1521060 to your computer and use it in GitHub Desktop.
Save anonymous/1521060 to your computer and use it in GitHub Desktop.
Code for omniauth fb pop-up login
# View file
<%= link_to image_tag("/images/facebook_connect.png"), "/auth/facebook", :class => 'login-popup' %>
# application.js
$('a.login-popup').click(function(e) {
var width = 600, height = 400;
var left = (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (2 * height / 3);
var features = 'menubar=no,toolbar=no,status=no,width=' + width + ',height=' + height + ',toolbar=no,left=' + left + ',top=' + top;
var loginWindow = window.open('/auth/facebook', '_blank', features);
loginWindow.focus();
e.preventDefault();
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment