Permalink
Browse files

Add "disable_with" to most form submits to prevent double submission

Should be able to remove when upgrading to Rails 5 thanks to
rails/rails#21135
  • Loading branch information...
tjgrathwell committed Sep 22, 2015
1 parent 54db350 commit a76c1976f111327aafc0e54a5e1ece5a217211e9
@@ -6,7 +6,7 @@
<%= f.input :name %>
<div class="actions">
<%= f.submit class: 'btn btn-submit' %>
<%= f.submit class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %>
</div>
<% end %>
</div>
@@ -7,7 +7,7 @@
<%= f.input :email %>
<div><%= f.submit "Resend confirmation instructions", class: 'btn btn-submit' %></div>
<div><%= f.submit "Resend confirmation instructions", class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %></div>
<% end %>
</div>
</div>
@@ -14,7 +14,7 @@
<%= f.password_field :password_confirmation %>
</div>
<div><%= f.submit "Change my password", class: 'btn btn-submit' %></div>
<div><%= f.submit "Change my password", class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
@@ -7,7 +7,7 @@
<%= f.input :email %>
<div><%= f.submit "Send me reset password instructions", class: 'btn btn-submit' %></div>
<div><%= f.submit "Send me reset password instructions", class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %></div>
<% end %>
</div>
</div>
@@ -82,7 +82,7 @@
</div>
</div>
<div><%= f.submit button_text, class: 'btn btn-submit' %></div>
<div><%= f.submit button_text, class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %></div>
<% if is_registered %>
<hr>
@@ -264,10 +264,10 @@
<div class="actions">
<% if @event.new_record? || @event.draft_saved %>
<%= f.submit class: 'btn btn-submit coc-required', name: 'create_event', value: 'Submit Event For Approval' %>
<%= f.submit class: 'btn btn-submit event-new-save-draft', name: 'save_draft', value: 'Save Draft' %>
<%= f.submit class: 'btn btn-submit coc-required', name: 'create_event', value: 'Submit Event For Approval', data: {disable_with: 'Please wait...'} %>
<%= f.submit class: 'btn btn-submit event-new-save-draft', name: 'save_draft', value: 'Save Draft', data: {disable_with: 'Please wait...'} %>
<% else %>
<%= f.submit class: 'btn btn-submit coc-required' %>
<%= f.submit class: 'btn btn-submit coc-required', data: {disable_with: 'Please wait...'} %>
<% end %>
</div>
<% end %>
@@ -77,7 +77,7 @@
</div>
</div>
<div style="margin-top: 10px;"><%= f.submit 'Send Mail', class: 'btn' %></div>
<div style="margin-top: 10px;"><%= f.submit 'Send Mail', class: 'btn', data: {disable_with: 'Please wait...'} %></div>
<% end %>
</div>
@@ -24,7 +24,7 @@
<%= f.input :organizers %>
<div class="actions">
<%= f.submit class: :btn %>
<%= f.submit class: :btn, data: {disable_with: 'Please wait...'} %>
</div>
<% end %>
</div>
@@ -23,9 +23,9 @@
<% end %>
<div class="actions">
<%= f.submit class: 'btn btn-submit' %>
<%= f.submit class: 'btn btn-submit', data: {disable_with: 'Please wait...'} %>
<% if @location.archivable_by?(current_user) %>
<%= f.submit 'Archive Location', class: 'btn btn-warning' %>
<%= f.submit 'Archive Location', class: 'btn btn-warning', data: {disable_with: 'Please wait...'} %>
<% end %>
</div>
<% end %>
@@ -168,7 +168,7 @@
<%= f.hidden_field :event_id %>
<%= f.hidden_field :role_id %>
<% unless @rsvp_preview_mode %>
<%= f.submit "Submit", class: 'btn btn-submit coc-required' %>
<%= f.submit "Submit", class: 'btn btn-submit coc-required', data: {disable_with: 'Please wait...'} %>
<% end %>
</div>
<% end %>
@@ -17,7 +17,9 @@
<%= f.label :recommendation_likelihood, "How likely are you to recommend a Railsbridge workshop to a friend or colleague? (10 is very likely, 1 is unlikely)" %>
<%= f.select :recommendation_likelihood, (1..10).to_a.reverse, {}, {class: 'form-control'} %>
<%= f.submit "Submit", class: "btn" unless @survey.persisted? %>
<% unless @survey.persisted? %>
<%= f.submit "Submit", class: "btn", data: {disable_with: 'Please wait...'} %>
<% end %>
<% end %>
</div>
</div>

0 comments on commit a76c197

Please sign in to comment.