|
|
|
@ -2,7 +2,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
layout "base_courses"
|
|
|
|
|
|
|
|
|
|
before_filter :find_exercise_and_course, :only => [:create_exercise_question]
|
|
|
|
|
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list,:edit]
|
|
|
|
|
before_filter :find_course, :only => [:index,:new,:student_exercise_list,:edit]
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
|
|
|
@ -46,7 +46,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
:time => Time.now,
|
|
|
|
|
:end_time => Time.now,
|
|
|
|
|
:publish_time => Time.now,
|
|
|
|
|
:polls_description => ""
|
|
|
|
|
:exercise_description => ""
|
|
|
|
|
}
|
|
|
|
|
@exercise = Exercise.create option
|
|
|
|
|
if @exercise
|
|
|
|
@ -76,7 +76,6 @@ class ExerciseController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit
|
|
|
|
|
@exercise = Exercise.find params[:id]
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html{render :layout => 'base_courses'}
|
|
|
|
|
end
|
|
|
|
@ -113,7 +112,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
# 添加题目
|
|
|
|
|
# question_type 1:单选 2:多选 3:填空题
|
|
|
|
|
def create_exercise_question
|
|
|
|
|
question_title = params[:exercise_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]
|
|
|
|
|
question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
|
|
|
|
|
option = {
|
|
|
|
|
:question_title => question_title,
|
|
|
|
|
:question_type => params[:question_type] || 1,
|
|
|
|
|