Skip to content

Commit

Permalink
Remove redundant _form_submit selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Apr 4, 2011
1 parent 8c359b9 commit c7490ec
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/views/hydrants/_abandon.html.erb
Expand Up @@ -2,5 +2,5 @@
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>
<%= f.submit "Abandon this hydrant", :id => "abandon_form_submit" %>
<%= f.submit "Abandon this hydrant" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/hydrants/_back.html.erb
@@ -1,4 +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" %>
<%= f.submit "Back" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/hydrants/_steal.html.erb
Expand Up @@ -2,5 +2,5 @@
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>
<%= f.submit "Steal this hydrant", :id => "steal_form_submit" %>
<%= f.submit "Steal this hydrant" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/hydrants/adopt.html.erb
Expand Up @@ -4,7 +4,7 @@
<%= f.hidden_field "user_id", :value => current_user.id %>
<%= f.label "name", "Give this hydrant a name", :id => "hydrant_name_label" %>
<%= f.text_field "name", :tabindex => 1 %>
<%= f.submit "Adopt!", :tabindex => 2, :id => "adoption_form_submit" %>
<%= f.submit "Adopt!", :tabindex => 2 %>
<p>By adopting this hydrant, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 3 %>.</p>
<% end %>
<%= render(:partial => 'users/edit_profile') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/sessions/_sign_in.html.erb
@@ -1,3 +1,3 @@
<%= form_for(:sign_in, :html => {:id => "sign_in_form"}) do |f| %>
<%= f.submit "Sign in", :id => "sign_in_form_submit" %>
<%= f.submit "Sign in" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/sessions/_sign_out.html.erb
@@ -1,3 +1,3 @@
<%= form_for(:sign_out, :html => {:id => "sign_out_form"}) do |f| %>
<%= f.submit "Sign out", :id => "sign_out_form_submit" %>
<%= f.submit "Sign out" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/users/_edit_profile.html.erb
@@ -1,3 +1,3 @@
<%= 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" %>
<%= f.submit "Edit profile" %>
<% end %>
18 changes: 10 additions & 8 deletions public/javascripts/application.js
Expand Up @@ -386,7 +386,7 @@ $(function() {
url: '/hydrant',
data: {
'id': $('#hydrant_id').val(),
'commit': $('#adoption_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#adoption_form input[name="authenticity_token"]').val(),
'_method': 'put',
Expand Down Expand Up @@ -432,7 +432,7 @@ $(function() {
url: '/hydrant',
data: {
'id': $('#hydrant_id').val(),
'commit': $('#abandon_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#abandon_form input[name="authenticity_token"]').val(),
'_method': 'put',
Expand Down Expand Up @@ -478,7 +478,7 @@ $(function() {
url: '/hydrant',
data: {
'id': $('#hydrant_id').val(),
'commit': $('#steal_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#steal_form input[name="authenticity_token"]').val(),
'_method': 'put',
Expand Down Expand Up @@ -515,11 +515,13 @@ $(function() {
return false;
});
$('#edit_profile_form').live('submit', function() {
var submitButton = $("#edit_profile_form input[type='submit']");
$(submitButton).attr("disabled", true);
$.ajax({
type: 'GET',
url: '/users/edit',
data: {
'commit': $('#edit_profile_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#edit_profile_form input[name="authenticity_token"]').val()
},
Expand Down Expand Up @@ -579,7 +581,7 @@ $(function() {
data: {
'id': $('#id').val(),
'hydrant_id': activeHydrantId,
'commit': $('#edit_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#edit_form input[name="authenticity_token"]').val(),
'_method': 'put',
Expand Down Expand Up @@ -654,7 +656,7 @@ $(function() {
type: 'GET',
url: '/users/sign_out.json',
data: {
'commit': $('#sign_out_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
},
Expand Down Expand Up @@ -684,7 +686,7 @@ $(function() {
type: 'GET',
url: '/users/sign_in',
data: {
'commit': $('#sign_in_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#sign_in_form input[name="authenticity_token"]').val(),
},
Expand All @@ -705,7 +707,7 @@ $(function() {
type: 'GET',
url: '/hydrant',
data: {
'commit': $('#back_form_submit').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#back_form input[name="authenticity_token"]').val(),
'hydrant_id': activeHydrantId
Expand Down

0 comments on commit c7490ec

Please sign in to comment.