diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index c8e5bf27c..d53dc067c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -299,16 +299,21 @@ class ExerciseController < ApplicationController # 发布试卷 def publish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save - redirect_to exercise_index_url(:course_id=> @course.id) + #redirect_to exercise_index_url(:course_id=> @course.id) + respond_to do |format| + format.js + end end end # 重新发布试卷 # 重新发布的时候会删除所有的答题 def republish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index a1c8aa8b1..008c95c24 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -50,7 +50,7 @@ diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 32cb556b3..b9306b0d2 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -46,7 +46,7 @@ diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index 16fa24b0e..d1774f637 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -11,7 +11,7 @@
<% @exercises.each do |exercise|%> -
diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index a7029d3ea..0555b997c 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -52,7 +52,7 @@
diff --git a/app/views/exercise/_new_question.html.erb b/app/views/exercise/_new_question.html.erb index 6148c9bb9..faadb08a9 100644 --- a/app/views/exercise/_new_question.html.erb +++ b/app/views/exercise/_new_question.html.erb @@ -8,7 +8,9 @@