Converted the Membership rate form to an Ajax remote form.

* Changed the form_for to be a remote_form_for
* Changed the url to use the js format
* Added RJS to add the Saved rate to the rate cell
* Added id to the table cell so the rate cell can be replaced on success
* Added an Error RJS to flash an error message

  #1921
This commit is contained in:
Eric Davis
2009-01-20 16:37:23 -08:00
parent 7930144e8c
commit 363e8c0c5a
4 changed files with 18 additions and 4 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
<%= link_to l(:button_delete), {:action => 'destroy_membership', :id => @user, :membership_id => membership }, :method => :post, :class => 'icon icon-del' %>
</td>
<%# TODO: Hook %>
<td>
<td id="rate_<%= membership.project.id %>">
<% rate = Rate.for(@user, membership.project) %>
<% if rate.default? || rate.nil? %>
@@ -31,7 +31,7 @@
<em><%= number_to_currency(rate.amount) %></em>
<% end %>
<% form_for(:rate, :url => rates_path) do |f| %>
<% remote_form_for(:rate, :url => formatted_rates_path('js')) do |f| %>
<%= f.text_field :amount %>
<%= f.hidden_field :date_in_effect, :value => Date.today.to_s %>