Add back button on edit view

This commit is contained in:
Erik Michaels-Ober 2011-04-03 21:00:34 -07:00
parent f673a39b55
commit e3fc106db1
9 changed files with 30 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<%= form_for @hydrant, :html => {:id => "abandon_form"} do |f| %>
<%= form_for(@hydrant, :html => {:id => "abandon_form"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>

View File

@ -0,0 +1,4 @@
<%= form_for(:hydrant, :url => '/hydrant', :html => {:id => "back_form", :method => "get"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.submit "Back", :id => "back_form_submit" %>
<% end %>

View File

@ -1,4 +1,4 @@
<%= form_for @hydrant, :html => {:id => "steal_form"} do |f| %>
<%= form_for(@hydrant, :html => {:id => "steal_form"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>

View File

@ -1,4 +1,4 @@
<%= form_for @hydrant, :html => {:id => "adoption_form"} do |f| %>
<%= form_for(@hydrant, :html => {:id => "adoption_form"}) do |f| %>
<h2>Adopt this Hydrant</h2>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => current_user.id %>

View File

@ -1,3 +1,3 @@
<%= form_for :user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :method => "get"} do |f| %>
<%= form_for(:user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :method => "get"}) do |f| %>
<%= f.submit "Edit profile", :id => "edit_profile_form_submit" %>
<% end %>

View File

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

View File

@ -17,3 +17,4 @@
<%= f.password_field "current_password", :tabindex => 7 %>
<%= f.submit "Update", :tabindex => 8, :id => "user_update_submit" %>
<% end %>
<%= render(:partial => 'hydrants/back') %>

View File

@ -1,4 +1,4 @@
<%= form_for :user, :html => {:id => "combo_form"} do |f| %>
<%= form_for(:user, :html => {:id => "combo_form"}) do |f| %>
<h2>Adopt this Hydrant</h2>
<div id="common_fields">
<%= f.label "email", "Email address", :id => "user_email_label" %>

View File

@ -677,4 +677,23 @@ $(function() {
}
return false;
});
$('#back_form').live('submit', function() {
var submitButton = $("#edit_form input[type='submit']");
$(submitButton).attr("disabled", true);
$.ajax({
type: 'GET',
url: '/hydrant',
data: {
'hydrant_id': activeHydrantId
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
success: function(data) {
activeInfoWindow.setContent(data);
}
});
return false;
});
});