public
Description: My money tracking app. There are many like it, but this one is mine.
Homepage:
Clone URL: git://github.com/dustin/money.git
Use PUT for enabling and disabling tasks.
dustin (author)
Sat May 24 15:51:19 -0700 2008
commit  4f527c1471b3c6fa3fb72a35562a01d2c0a53b8b
tree    7ad7807050c4e94f274a9c2a6a0524dcceca4aae
parent  e32f222b60251c00a9a2324129c21096b0a1c068
...
37
38
39
40
 
41
42
43
...
37
38
39
 
40
41
42
43
0
@@ -37,7 +37,7 @@ class AllowanceTasksController < ApplicationController
0
   end
0
 
0
   # Toggle the active state of a task
0
-  def task_toggle
0
+  def update
0
     task=AllowanceTask.find params[:id].to_i
0
     active = (params[:active] == 'true')
0
     task.deleted = !active
...
19
20
21
22
23
24
25
 
 
26
27
28
...
19
20
21
 
 
 
 
22
23
24
25
26
0
@@ -19,10 +19,8 @@
0
         <tr id="task_<%= t.id %>" <%= t.deleted ? 'class="deleted"' : '' %>>
0
           <td>
0
             <%= content_tag :input, '', :type => :checkbox,
0
-                            :onclick => remote_function(:url => {
0
-                                                          :controller => :allowance,
0
-                                                          :action => :task_toggle,
0
-                                                          :id => t.id},
0
+                            :onclick => remote_function(:url => allowance_task_path(t),
0
+                                                        :method => :put,
0
                                                         :with => "'active='+this.checked"),
0
                                         :checked => 'checked' %>
0
           </td>
...
88
89
90
91
 
92
93
94
...
97
98
99
100
 
101
102
103
...
88
89
90
 
91
92
93
94
...
97
98
99
 
100
101
102
103
0
@@ -88,7 +88,7 @@ class AllowanceTasksControllerTest < Test::Unit::TestCase
0
   def test_deactivation
0
     login_as :quentin
0
     assert_difference 'AllowanceTask.count_active', -1 do
0
-      xhr :post, :task_toggle, :id => 1, :active => 'false'
0
+      xhr :post, :update, :id => 1, :active => 'false'
0
       assert_response :success
0
       assert_template 'allowance_tasks/deactivate'
0
     end
0
@@ -97,7 +97,7 @@ class AllowanceTasksControllerTest < Test::Unit::TestCase
0
   def test_activation
0
     login_as :quentin
0
     assert_difference 'AllowanceTask.count_active' do
0
-      xhr :post, :task_toggle, :id => 4, :active => 'true'
0
+      xhr :post, :update, :id => 4, :active => 'true'
0
       assert_response :success
0
       assert_template 'allowance_tasks/activate'
0
     end

Comments