diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index aba2fb58e..5792c6487 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -86,6 +86,31 @@ module ExerciseHelper return result end + def convert_to_chi_num num + result = "" + case num.to_i + when 1 + result = '一' + when 2 + result = '二' + when 3 + result = '三' + when 4 + result = '四' + when 5 + result = '五' + when 6 + result = '六' + when 7 + result = '七' + when 8 + result = '八' + when 9 + result = '九' + end + return result + end + def get_current_score exercise score = 0 unless exercise.nil? diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index f4ececf8f..1da0b9038 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -8,7 +8,7 @@ $("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>") $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" + "
  • " + - "" + + "" + "" + "" + "" + @@ -34,7 +34,7 @@
    <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
  • - + diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index 18ae79d1c..48422be1c 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -8,7 +8,7 @@ $("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>") $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" + "
  • " + - "" + + "" + "" + "" + "" + @@ -34,7 +34,7 @@
    <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
  • - + diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb index 0ce2f0943..52e865ba4 100644 --- a/app/views/exercise/_edit_single.html.erb +++ b/app/views/exercise/_edit_single.html.erb @@ -7,7 +7,7 @@ $("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>") $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>" + "
  • " + - "" + + "" + "" + "" + @@ -34,7 +34,7 @@
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
  • - + diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index f0bef74bf..ec099cb09 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -162,15 +162,38 @@ //单选题 function add_single_answer(doc) { - doc.parent().after("
  • " + + var li = doc.parent().after("
  • " + ""+ "
  • "); + var select_items =$("label[name='select_items']",li.parent()); + for(var i=0; i:   "); + } } function add_candidate_answer(doc) { - doc.parent().after("
  • " + + doc.parent().after("
  • " + ""+ "
  • "); + var select_items =$("label[name='candiate_items']",doc.parent().parent()); + for(var i=0; i:   "); + } + } + function revert_to_chinese_num(num){ + var s_num = ""; + switch (num) { + case 1: s_num = '一'; break; + case 2: s_num = '二'; break; + case 3: s_num = '三'; break; + case 4: s_num = '四'; break; + case 5: s_num = '五'; break; + case 6: s_num = '六'; break; + case 7: s_num = '七'; break; + case 8: s_num = '八'; break; + case 9: s_num = '九'; break; + } + return s_num; } function remove_single_answer(doc) { @@ -180,7 +203,16 @@ } else { + var parent = doc.parent().parent(); doc.parent().remove(); + var select_items =$("label[name='select_items']",parent); + var candiate_items =$("label[name='candiate_items']",parent); + for(var i=0; i:   "); + } + for(var i=0; i:   "); + } } } diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 0d7350570..6fd6c201e 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -18,28 +18,28 @@
  • - +
  • - +
  • - +
  • - + diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index 3ea198d8f..a24835fc1 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -18,28 +18,28 @@
  • - +
  • - +
  • - +
  • - + diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 061b053fd..3a65c072d 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -18,22 +18,22 @@
  • - - + +
  • - - + +
  • - - + +
  • diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index d052bd6da..eef7546e5 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -55,28 +55,28 @@ '分'+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index a477303d7..9e66f17f9 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -54,28 +54,28 @@ '分'+ '
  • '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index 86203b8bb..90f604da1 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -9,7 +9,7 @@
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 候选答案:<%= exercise_choice.answer_text%>
    + 候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
    <% end %>
  • @@ -42,22 +42,22 @@ '分'+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index bcace8cf2..1cb288d51 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -152,4 +152,6 @@ a:hover.btn_pu{ background:#3cb761;} .polls_alert_upload_box{ width:120px; margin:15px auto;} .polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;} +.w56 { width: 56px;} +