diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb
index 4ac594d76..863f68a72 100644
--- a/app/views/exercise/_exercise_form.html.erb
+++ b/app/views/exercise/_exercise_form.html.erb
@@ -60,60 +60,74 @@
}
function insert_MC(quest_type,quest_num,quest_id){
- $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
- '<%= form_for(ExerciseQuestion.new,
- :html => { :multipart => true },
- :url => {:controller => 'exercise',
- :action => 'create_exercise_question',
- :course_id => @course.id
- },:remote=>true ) do |f|%>'+
- '
'+
- '
'+
- ''+
- ''+
- ''+
- ''+
- ''+
- ''+
- ''+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- '<% end%>'
- );
+ if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
+ '<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
+ '
'+
+ '
'+
+ ''+
+ ''+
+ ''+
+ ''+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '<% end%>'
+ );
+ }
+ else {
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
+ }
$("#poll_questions_title").focus();
}
@@ -123,60 +137,73 @@
}
function insert_MCQ(quest_type,quest_num,quest_id){
- $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
- '<%= form_for(ExerciseQuestion.new,
- :html => { :multipart => true },
- :url => {:controller => 'exercise',
- :action => 'create_exercise_question',
- :course_id => @course.id
- },:remote=>true ) do |f|%>'+
- '
'+
- '
'+
- ''+
- ''+
- ''+
- ''+
- ''+
- ''+
- ''+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- '<% end%>'
- );
+ if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
+ '<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
+ '
'+
+ '
'+
+ ''+
+ ''+
+ ''+
+ ''+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '<% end%>'
+ );
+ } else {
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
+ }
$("#poll_questions_title").focus();
}
@@ -186,35 +213,61 @@
}
function insert_SINGLE(quest_type,quest_num,quest_id){
- $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
- '<%= form_for(ExerciseQuestion.new,
- :html => { :multipart => true },
- :url => {:controller => 'exercise',
- :action => 'create_exercise_question',
- :course_id => @course.id
- },:remote=>true ) do |f|%>'+
- '
'+
- '<% end%>'
- );
+ if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
+ '<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
+ '
'+
+ '
'+
+ ''+
+ ''+
+ ''+
+ ''+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '<% end%>'
+ );
+ } else {
+ $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
+ }
$("#poll_questions_title").focus();
}
@@ -247,13 +300,13 @@
function add_poll_question(doc)
{
var title = $.trim($("#poll_questions_title").val());
- if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
+ if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
{
var title = $.trim($("#poll_questions_title_" + id).val());
- if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
+ if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头
diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb
index 4d9baf729..a8c6f57ea 100644
--- a/app/views/exercise/_new_single.html.erb
+++ b/app/views/exercise/_new_single.html.erb
@@ -20,17 +20,23 @@
-
+
+
+
-
+
+
+
-
+
+
+
diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb
index d44652603..241cc6009 100644
--- a/app/views/exercise/_show_MC.html.erb
+++ b/app/views/exercise/_show_MC.html.erb
@@ -7,7 +7,7 @@
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>