From b10fbcde8c2b3c8fb735d5648a60005462472223 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 20:44:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8F=91=E5=B8=83=E5=92=8C?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=8B=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 7 ++++++- app/views/exercise/_edit_MC.html.erb | 2 +- app/views/exercise/_edit_MCQ.html.erb | 2 +- app/views/exercise/_edit_single.html.erb | 2 +- app/views/exercise/_exercise_form.html.erb | 12 ++++++------ app/views/exercise/_exercises_list.html.erb | 2 +- app/views/exercise/_new_MC.html.erb | 2 +- app/views/exercise/_new_MCQ.html.erb | 2 +- app/views/exercise/_new_single.html.erb | 2 +- app/views/exercise/_show_MC.html.erb | 2 +- app/views/exercise/_show_MCQ.html.erb | 2 +- app/views/exercise/_show_single.html.erb | 2 +- app/views/exercise/index.html.erb | 2 +- app/views/exercise/republish_exercise.js.erb | 2 +- 14 files changed, 24 insertions(+), 19 deletions(-) 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/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 1ee79e198..08b31087a 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -40,7 +40,7 @@
diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index b932eac1e..5c214165a 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -90,7 +90,7 @@ ''+ ''+ ''+ ''+ '