diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -135,6 +135,14 @@ end end + def toggle_view_testcase + @problem = Problem.find(params[:id]) + @problem.update_attributes(view_testcase: !(@problem.view_testcase?) ) + respond_to do |format| + format.js { } + end + end + def turn_all_off Problem.available.all.each do |problem| problem.available = false @@ -222,10 +230,6 @@ redirect_to :action => 'manage' end - def show_testcase - @problem = Problem.includes(:testcases).find(params[:id]) - end - ################################## protected