单选多选还原

This commit is contained in:
Tim 2015-11-26 11:10:17 +08:00
parent 2a73751fd9
commit 09e0e5e93d
7 changed files with 31 additions and 28 deletions

View File

@ -8,7 +8,6 @@
$("#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| %>" +
"<li class='ur_item'>" +
"<input type='radio' style='width: 15px;' />"+
"<label>选项<%=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 %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
@ -30,14 +29,12 @@
<li class="ur_item">
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
<span class="ml10">标准答案:请选择</span>
</li>
<div class="cl"></div>
<div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item">
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="radio" style="width: 15px;" />
<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_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -45,6 +42,10 @@
<div class="cl"></div>
<% end %>
</div>
<li class="ur_item">
<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A在此输入A即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
</li>
<div class="cl"></div>
</ul>
</div>

View File

@ -29,14 +29,12 @@
<li class="ur_item">
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
<span class="ml10">标准答案:请选择</span>
</li>
<div class="cl"></div>
<div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item">
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="checkbox" style="width: 15px;" />
<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_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -44,6 +42,11 @@
<div class="cl"></div>
<% end %>
</div>
<li class="ur_item">
<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">

View File

@ -162,7 +162,7 @@
//单选题
function add_single_answer(doc)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input type='radio' style='width: 15px;' /><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
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='输入选项内容'/>" +
"<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>");
}

View File

@ -14,13 +14,11 @@
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
<span class="ml15">标准答案:请选择</span>
</li>
<div class="cl"></div>
<div>
<li class="ur_item">
<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="radio" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -28,7 +26,6 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="radio" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -36,7 +33,6 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="radio" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -44,13 +40,17 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="radio" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
</div>
<div class="cl"></div>
<li class="ur_item">
<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A在此输入A即可" type="text">
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">

View File

@ -14,13 +14,11 @@
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
<span class="ml10">标准答案:请选择</span>
</li>
<div class="cl"></div>
<div>
<li class="ur_item">
<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="checkbox" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -28,7 +26,6 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="checkbox" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -36,7 +33,6 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="checkbox" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
@ -44,13 +40,17 @@
<div class="cl"></div>
<li class="ur_item">
<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="checkbox" style="width: 15px;" />
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
</div>
<div class="cl"></div>
<li class="ur_item">
<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text">
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">

View File

@ -5,8 +5,7 @@
</div>
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de",:title => "删除") %>
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=exercise_question.id%>" onclick="dismiss('mc',<%=exercise_question.id%>);insert_MC('mc',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
<div class="cl"></div>
@ -54,11 +53,9 @@
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'<span class="ml15">标准答案:请选择</span>'+
'</li><div>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="radio" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -66,7 +63,6 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="radio" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -74,7 +70,6 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="radio" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -82,12 +77,16 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="radio" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li></div>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A在此输入A即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+

View File

@ -52,11 +52,9 @@
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'<span class="ml10">标准答案:请选择</span>'+
'</li><div>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="checkbox" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -64,7 +62,6 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="checkbox" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -72,7 +69,6 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="checkbox" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
@ -80,12 +76,16 @@
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="checkbox" style="width: 15px;" />'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li></div>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+