You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/app/controllers/exercise_controller.rb

53 lines
750 B

class ExerciseController < ApplicationController
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create]
def index
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
exercises = @course.exercises
else
exercises = @course.exercises.where(:exercise_status => 1)
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|
format.html
end
end
def show
end
def new
end
def create
end
def edit
end
def update
end
def destroy
end
#统计结果
def statistics_result
end
private
def find_course
@course = Course.find params[:course_id]
rescue Exception => e
render_404
end
end