diff --git a/app/controllers/graders_controller.rb b/app/controllers/graders_controller.rb --- a/app/controllers/graders_controller.rb +++ b/app/controllers/graders_controller.rb @@ -1,7 +1,13 @@ class GradersController < ApplicationController - - before_filter :authorization + before_filter :admin_authorization + + verify :method => :post, :only => ['clear_all'], + :redirect_to => {:action => 'index'} + + def index + redirect_to :action => 'list' + end def list @grader_processes = GraderProcess.find(:all, @@ -15,4 +21,31 @@ redirect_to :action => 'list' end + def clear_all + GraderProcess.find(:all).each do |p| + p.destroy + end + redirect_to :action => 'list' + end + + def view + if params[:type]=='Task' + redirect_to :action => 'task', :id => params[:id] + else + redirect_to :action => 'test_request', :id => params[:id] + end + end + + def test_request + @test_request = TestRequest.find(params[:id]) + end + + def task + @task = Task.find(params[:id]) + end + + def submission + @submission = Submission.find(params[:id]) + end + end