在线测验的选项和候选答案的正确显示

This commit is contained in:
cxt 2016-03-01 15:18:38 +08:00
parent 072300331b
commit f6f84b564e
12 changed files with 96 additions and 37 deletions

View File

@ -86,6 +86,31 @@ module ExerciseHelper
return result return result
end 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 def get_current_score exercise
score = 0 score = 0
unless exercise.nil? unless exercise.nil?

View File

@ -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_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| %>" + $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" + "<li class='ur_item'>" +
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" + "<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" + "<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" + "<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" + "<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -34,7 +34,7 @@
<div id="poll_answers_<%=exercise_question.id%>"> <div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item"> <li class="ur_item">
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>"> <input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -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_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| %>" + $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" + "<li class='ur_item'>" +
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" + "<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" + "<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" + "<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" + "<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -34,7 +34,7 @@
<div id="poll_answers_<%=exercise_question.id%>"> <div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item"> <li class="ur_item">
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>"> <input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -7,7 +7,7 @@
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>") $("#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| %>" + $("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" + "<li class='ur_item'>" +
"<label>候选答案<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" + "<label name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input class='candiate_answer' name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" + "<input class='candiate_answer' name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a>" + "<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a>" +
@ -34,7 +34,7 @@
<div id="poll_answers_<%=exercise_question.id%>"> <div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
<li class="ur_item"> <li class="ur_item">
<label>候选答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/> <input class="candiate_answer" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/>
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>

View File

@ -162,15 +162,38 @@
//单选题 //单选题
function add_single_answer(doc) function add_single_answer(doc)
{ {
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" + var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w56'>选项&nbsp;<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+ "<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>"); "</li><div class='cl'></div>");
var select_items =$("label[name='select_items']",li.parent());
for(var i=0; i<select_items.length; i++){
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;");
}
} }
function add_candidate_answer(doc) function add_candidate_answer(doc)
{ {
doc.parent().after("<li class='ur_item'><label>候选答案<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" + doc.parent().after("<li class='ur_item'><label name='candiate_items'>候选答案<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+ "<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>"); "</li><div class='cl'></div>");
var select_items =$("label[name='candiate_items']",doc.parent().parent());
for(var i=0; i<select_items.length; i++){
$(select_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;");
}
}
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) function remove_single_answer(doc)
{ {
@ -180,7 +203,16 @@
} }
else else
{ {
var parent = doc.parent().parent();
doc.parent().remove(); doc.parent().remove();
var select_items =$("label[name='select_items']",parent);
var candiate_items =$("label[name='candiate_items']",parent);
for(var i=0; i<select_items.length; i++){
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;");
}
for(var i=0; i<candiate_items.length; i++){
$(candiate_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;");
}
} }
} }
</script> </script>

View File

@ -18,28 +18,28 @@
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<li class="ur_item"> <li class="ur_item">
<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/> <input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/> <input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -18,28 +18,28 @@
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<li class="ur_item"> <li class="ur_item">
<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='select_items' class='w56'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'> <input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -18,22 +18,22 @@
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<li class="ur_item"> <li class="ur_item">
<label>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='candiate_items'>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer" name="exercise_choice[0]" placeholder="请输入候选答案" type="text"> <input class="candiate_answer" name="exercise_choice[0]" placeholder="请输入候选答案" type="text">
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='candiate_items'>候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer" name="exercise_choice[1]" placeholder="请输入候选答案(选填)" type="text"> <input class="candiate_answer" name="exercise_choice[1]" placeholder="请输入候选答案(选填)" type="text">
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">
<label>候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label name='candiate_items'>候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer" name="exercise_choice[2]" placeholder="请输入候选答案(选填)" type="text"> <input class="candiate_answer" name="exercise_choice[2]" placeholder="请输入候选答案(选填)" type="text">
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a> <a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> <a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li> </li>

View File

@ -55,28 +55,28 @@
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+ '<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li><div>'+ '</li><div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+

View File

@ -54,28 +54,28 @@
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+ '<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li><div>'+ '</li><div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="select_items" class="w56">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+ '<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+

View File

@ -9,7 +9,7 @@
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
候选答案:<%= exercise_choice.answer_text%><br /> 候选答案<%= convert_to_chi_num(index+1) %><%= exercise_choice.answer_text%><br />
<% end %> <% end %>
</div> </div>
</div> </div>
@ -42,22 +42,22 @@
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+ '<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li><div>'+ '</li><div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="candiate_items">候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input class="candiate_answer" type="text" name="exercise_choice[0]" placeholder="请输入候选答案"/>'+ '<input class="candiate_answer" type="text" name="exercise_choice[0]" placeholder="请输入候选答案"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="candiate_items">候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案(选填)"/>'+ '<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label name="candiate_items">候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案(选填)"/>'+ '<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li></div>'+ '</li></div>'+

View File

@ -152,4 +152,6 @@ a:hover.btn_pu{ background:#3cb761;}
.polls_alert_upload_box{ width:120px; margin:15px auto;} .polls_alert_upload_box{ width:120px; margin:15px auto;}
.polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;} .polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;}
.w56 { width: 56px;}