[Deliver #10838389] Add sign out form

This commit is contained in:
Erik Michaels-Ober 2011-03-17 19:50:47 -07:00
parent cc07af72fb
commit 009912765b
4 changed files with 22 additions and 3 deletions

View File

@ -9,3 +9,4 @@
<p>By adopting this hydrant, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 3 %>.</p> <p>By adopting this hydrant, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 3 %>.</p>
</div> </div>
<% end %> <% end %>
<%= render :partial => 'sign_out_form' %>

View File

@ -0,0 +1,3 @@
<%= form_for :sign_out, :html => {:id => "sign_out_form"} do |f| %>
<%= f.submit "Sign out", :id => "sign_out_form_submit" %>
<% end %>

View File

@ -1 +1,2 @@
<h2>Thank you for adopting this hydrant!</h2> <h2>Thank you for adopting this hydrant!</h2>
<%= render :partial => 'sign_out_form' %>

View File

@ -187,7 +187,7 @@ $(function() {
$.post('<%= user_registration_path :format => "json" %>', { $.post('<%= user_registration_path :format => "json" %>', {
'commit': $('#user_sign_up_submit').val(), 'commit': $('#user_sign_up_submit').val(),
'utf8': '✓', 'utf8': '✓',
'authenticity_token': $('input[name="authenticity_token"]').val(), 'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'user': { 'user': {
'email': $('#user_email').val(), 'email': $('#user_email').val(),
'name': $('#user_name').val(), 'name': $('#user_name').val(),
@ -254,7 +254,7 @@ $(function() {
$.post('<%= user_session_path :format => "json" %>', { $.post('<%= user_session_path :format => "json" %>', {
'commit': $('#user_sign_in_submit').val(), 'commit': $('#user_sign_in_submit').val(),
'utf8': '✓', 'utf8': '✓',
'authenticity_token': $('input[name="authenticity_token"]').val(), 'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'user': { 'user': {
'email': $('#user_email').val(), 'email': $('#user_email').val(),
'password': $('#user_password').val(), 'password': $('#user_password').val(),
@ -281,7 +281,7 @@ $(function() {
$.post('<%= user_password_path :format => "json" %>', { $.post('<%= user_password_path :format => "json" %>', {
'commit': $('#user_forgot_password_submit').val(), 'commit': $('#user_forgot_password_submit').val(),
'utf8': '✓', 'utf8': '✓',
'authenticity_token': $('input[name="authenticity_token"]').val(), 'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'user': { 'user': {
'email': $('#user_email').val() 'email': $('#user_email').val()
} }
@ -299,6 +299,20 @@ $(function() {
} }
return false; return false;
}); });
$('#sign_out_form').live('submit', function() {
$.get('<%= destroy_user_session_path :format => "json" %>', {
'commit': $('#sign_out_form_submit').val(),
'utf8': '✓',
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
}, function(data) {
$.get('<%= contents_path %>', {
'hydrant_id': activeHydrantId
}, function(data) {
activeInfoWindow.setContent(data);
});
});
return false;
});
$('#adoption_form').live('submit', function() { $('#adoption_form').live('submit', function() {
$.post('<%= hydrant_path :format => "json" %>', { $.post('<%= hydrant_path :format => "json" %>', {
'id': $('#hydrant_id').val(), 'id': $('#hydrant_id').val(),