Login form working in jQuery

This commit is contained in:
Eric Allen 2009-09-02 11:40:21 -04:00
parent 35c9f55553
commit 4c68144c93
3 changed files with 15 additions and 14 deletions

View file

@ -4,6 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%= stylesheet_link_tag "scaffold" %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'jquery.cookie' %>
<title><%= @page_title -%></title>

View file

@ -74,5 +74,5 @@ function showPreferredAuth() {
Login.showOpenid();
}
}
Event.observe(window, 'load', showPreferredAuth);
</script>
$(document).ready(showPreferredAuth);
</script>

View file

@ -1,21 +1,21 @@
var Login = {
showOpenid: function() {
if ($('database_auth_form')) $('database_auth_form').hide();
if ($('openid_auth_form')) $('openid_auth_form').show();
if ($('alternate_auth_openid')) $('alternate_auth_openid').hide();
if ($('alternate_auth_database')) $('alternate_auth_database').show();
if ($('openid_url')) $('openid_url').focus();
if ($('openid_url')) $('openid_url').select();
$('#database_auth_form').hide();
$('#openid_auth_form').show();
$('#alternate_auth_openid').hide();
$('#alternate_auth_database').show();
$('#openid_url').focus();
$('#openid_url').select();
$.cookie('preferred_auth', 'openid');
},
showDatabase: function(container) {
if ($('openid_auth_form')) $('openid_auth_form').hide();
if ($('database_auth_form')) $('database_auth_form').show();
if ($('alternate_auth_database')) $('alternate_auth_database').hide();
if ($('alternate_auth_openid')) $('alternate_auth_openid').show();
if ($('user_login')) $('user_login').focus();
if ($('user_login')) $('user_login').select();
$('#openid_auth_form').hide();
$('#database_auth_form').show();
$('#alternate_auth_database').hide();
$('#alternate_auth_openid').show();
$('#user_login').focus();
$('#user_login').select();
$.cookie('preferred_auth', 'database');
}
}