31 lines
921 B
Plaintext
31 lines
921 B
Plaintext
:javascript
|
|
function login()
|
|
{
|
|
new Ajax.Request($('login_form').action,
|
|
{
|
|
parameters: Form.serialize($('login_form')),
|
|
onCreate: function(){ $('indicator').show(); },
|
|
onComplete: function(){ $('indicator').hide(); },
|
|
onSuccess: function(){ window.location.href = '/'; },
|
|
onFailure: function(){
|
|
new Effect.Shake($('fieldset'));
|
|
$('password').value = '';
|
|
$('password').focus();
|
|
}
|
|
});
|
|
}
|
|
|
|
= form :action => url(:sessions), :id => 'login_form', :onsubmit => "login(); return false;" do
|
|
%fieldset#fieldset{ :style => "width: 250px;" }
|
|
%legend Papers, comrade?
|
|
%p
|
|
%label{ :for => 'user_name' }
|
|
User Name
|
|
= text_field :name => 'user_name', :id => 'user_name'
|
|
%p
|
|
%label{ :for => 'password' }
|
|
Password
|
|
= password_field :name => 'password', :id => 'password'
|
|
= submit 'Login'
|
|
= indicator
|