From 7f2e049dc6af20f069ba06fc3df19cb33fe1d1de Mon Sep 17 00:00:00 2001 From: Austin Fonacier Date: Thu, 17 Dec 2009 16:03:22 -0800 Subject: [PATCH] Adding the ability to actually disable questions --- app/controllers/questions_controller.rb | 7 +++++++ public/javascripts/application.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index be3bd56..1c619c8 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -82,6 +82,13 @@ def update end end + def disable + @question = Question.find(params[:id]) + @question.disable = true + @question.save! + head :ok + end + # /questions/admin def admin @questions = Question.all_ready_to_go diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c96d8c7..8969be1 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -16,6 +16,6 @@ $(document).ready(function(){ var parent_tr = $(this).parents("tr")[0]; $(parent_tr).slideUp(); var id = $(parent_tr).attr("id"); - // AJAX the update POST + $.post("/questions/"+id+"/disable", { _method: "put", authenticity_token: encodeURIComponent(window._auth_token)}); }); }); \ No newline at end of file