diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 863f68a72..4bb2c31ab 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -54,223 +54,6 @@ } } - function add_MC(){ - $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>"); - $("#poll_questions_title").focus(); - } - - function insert_MC(quest_type,quest_num,quest_id){ - 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(); - } - - function add_MCQ(){ - $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>"); - $("#poll_questions_title").focus(); - } - - function insert_MCQ(quest_type,quest_num,quest_id){ - 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(); - } - - function add_single(){ - $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>"); - $("#poll_questions_title").focus(); - } - - function insert_SINGLE(quest_type,quest_num,quest_id){ - 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(); - } - //选择导入调查问卷 function importPoll(){ importPollPopWindow = $("#import_poll"); @@ -297,10 +80,15 @@ } //添加标题时确定按钮 - function add_poll_question(doc) + function add_poll_question(doc,quest_type,quest_id) { - var title = $.trim($("#poll_questions_title").val()); - if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();} + if(arguments[1] && arguments[2]){ + var title = $.trim($("#poll_questions_title_"+quest_type+"_"+quest_id)); + if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();} + } else { + var title = $.trim($("#poll_questions_title").val()); + if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();} + } } //修改标题时确定按钮 function edit_poll_question(doc,id) @@ -394,13 +182,8 @@ <%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%> -
- -
+
+ <%= render :partial => 'new_question', :locals => {:exercise => @exercise} %>
diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 158f8be96..3da0021ce 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -13,8 +13,9 @@
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index db9468350..37199a70e 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -1,6 +1,7 @@ <% if @is_insert %> $("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>'); <% else %> + $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); $("#new_poll_question").html(""); <%if @exercise_questions.question_type == 1%> $("#mc_question_list").show().append("
" +