Created
April 26, 2012 16:35
-
-
Save Znow/2500842 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(".completed").live("change", function(task) { | |
| $.ajax({ | |
| url: "/admin/tasks/completed", | |
| beforeSend: function() { alert("Hi"+task) }, | |
| data: "id="+task, | |
| success: function() { alert('Bye') } | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% @tasks_responsible.each do |t| %> | |
| <tr> | |
| <td> | |
| <%= check_box_tag "completed", t.id, false, :class => "completed" %> | |
| </td> | |
| <td><%= t.task_type %></td> | |
| <td><%= link_to "#{truncate(t.subject, :length => 20)}", admin_task_path(t) %></td> | |
| <td><%= t.responsible(&:name) %></td> | |
| <td><%= link_to t.client, admin_client_path(t.client) unless t.client.nil? %></td> | |
| <td><%= t.deadline.strftime("%d/%m/%y %H:%M") %></td> | |
| <td><%= t.author(&:name) %></td> | |
| <td> | |
| <a data-toggle="modal" href="#editTask<%= t.id %>"><%= image_tag "edit.png" %></a> | |
| <a data-toggle="modal" href="#deleteTask<%= t.id %>"><%= image_tag "delete.png" %></a> | |
| </td> | |
| </tr> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def completed | |
| @task = Task.find(params[:id]) | |
| if @task.completed | |
| @task.update_attributes :completed, true | |
| else | |
| @task.update_attributes :completed, false | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Started GET "/admin/tasks/completed?id=[object%20Object]" for 127.0.0.1 at 2012-04-26 18:27:48 +0200 | |
| Processing by Admin::TasksController#show as */* | |
| Parameters: {"id"=>"completed"} | |
| User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 | |
| Task Load (0.1ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."id" = ? LIMIT 1 [["id", "completed"]] | |
| Completed 500 Internal Server Error in 3ms | |
| ActiveRecord::RecordNotFound (Couldn't find Task with id=completed): | |
| app/controllers/admin/tasks_controller.rb:15:in `show' | |
| Rendered /Users/znowm4n/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.3ms) | |
| Rendered /Users/znowm4n/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms) | |
| Rendered /Users/znowm4n/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.3ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment