From bc39b68bb2180b5e55296611627b206c39e99c9f Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 13 May 2016 16:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=B5=8B=E9=AA=8C=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E3=80=81=E9=97=AE=E5=8D=B7=E9=A2=98=E7=9B=AE=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=A4=9A=E6=AC=A1=E6=8F=90=E4=BA=A4=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_form.html.erb | 9 ++++ app/views/exercise/_new_MC.html.erb | 11 +++- app/views/exercise/_new_MCQ.html.erb | 11 +++- app/views/exercise/_new_single.html.erb | 11 +++- app/views/exercise/_show_MC.html.erb | 5 +- app/views/exercise/_show_MCQ.html.erb | 5 +- app/views/exercise/_show_single.html.erb | 5 +- app/views/poll/_new_MC.html.erb | 13 +++-- app/views/poll/_new_MCQ.html.erb | 13 +++-- app/views/poll/_new_mulit.html.erb | 13 +++-- app/views/poll/_new_single.html.erb | 13 +++-- app/views/poll/_poll_form.html.erb | 60 +++++++++++++++++----- app/views/poll/create_poll_question.js.erb | 2 +- 13 files changed, 135 insertions(+), 36 deletions(-) diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index ec099cb09..f8fe7896c 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -87,10 +87,19 @@ var standard_ans = $.trim($("#question_standard_ans").val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); }else if(!/^[1-9][0-9]*$/.test(score)) { alert("分数必须是非零开头的数字"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); }else if(quest_type !=3 && standard_ans.length == 0) { alert("标准答案不能为空"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); }else{ doc.parent().parent().parent().submit();} } diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 6fd6c201e..43628f104 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -54,9 +54,16 @@
-<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index a24835fc1..875b9ec4c 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -54,9 +54,16 @@
-<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 6180dac8e..24a0ad047 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -42,9 +42,16 @@
-<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index eef7546e5..99c48a3ab 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -90,7 +90,7 @@ ''+ ''+ ''+ ''+ ' -<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file diff --git a/app/views/poll/_new_MCQ.html.erb b/app/views/poll/_new_MCQ.html.erb index 43b41f95d..0fbb588c5 100644 --- a/app/views/poll/_new_MCQ.html.erb +++ b/app/views/poll/_new_MCQ.html.erb @@ -3,7 +3,7 @@
- +
@@ -33,7 +33,7 @@
-<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file diff --git a/app/views/poll/_new_mulit.html.erb b/app/views/poll/_new_mulit.html.erb index 8a2205760..d25d34542 100644 --- a/app/views/poll/_new_mulit.html.erb +++ b/app/views/poll/_new_mulit.html.erb @@ -3,7 +3,7 @@
- +
@@ -13,7 +13,7 @@
-<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file diff --git a/app/views/poll/_new_single.html.erb b/app/views/poll/_new_single.html.erb index 7588bf3b4..fe8e7b604 100644 --- a/app/views/poll/_new_single.html.erb +++ b/app/views/poll/_new_single.html.erb @@ -3,12 +3,12 @@
- +
-<% end%> \ No newline at end of file +<% end%> + \ No newline at end of file diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index e08b13033..73c783794 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -51,8 +51,8 @@ function chooseQuestionType(quest_type,quest_id){ } function add_MC(){ - $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>"); - $("#poll_questions_title").focus(); + $("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MC') %>"); + $("#poll_questions_title_new").focus(); } function insert_MC(quest_type,quest_num,quest_id){ @@ -94,7 +94,7 @@ function add_MC(){ ''+ ''+ '
'+ ''+ '