2015-11-18 14:05:29 +08:00
<div>
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
</div>
2015-11-20 21:14:09 +08:00
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number),
2015-11-18 14:05:29 +08:00
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>
2015-11-19 09:13:46 +08:00
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=exercise_question.id%>" onclick="dismiss('mcq',<%=exercise_question.id%>);insert_MCQ('mcq',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
2015-11-18 14:05:29 +08:00
<div class="cl"></div>
<div class="ur_inputs">
2015-11-18 20:14:19 +08:00
<table class="ur_table" style="width:675px;">
2015-11-18 14:05:29 +08:00
<tbody>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<tr>
<td>
<label>
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div><!--多选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
</div>
2015-11-19 11:37:49 +08:00
<script type="text/javascript">
function insert_MCQ(quest_type,quest_num,quest_id){
2015-11-19 14:35:51 +08:00
var forms = $("form.new_exercise_question");
2015-11-19 11:37:49 +08:00
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
2015-11-19 14:35:51 +08:00
if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else {
<% score =exercise_question.question_score %>
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
2015-11-20 11:08:50 +08:00
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
2015-11-19 14:35:51 +08:00
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题: </label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
2015-11-20 17:25:03 +08:00
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
2015-11-19 14:35:51 +08:00
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>: </label>'+
2015-11-20 17:25:03 +08:00
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
2015-11-19 14:35:51 +08:00
'</li>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>: </label>'+
'<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>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>: </label>'+
'<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>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>: </label>'+
'<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>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>: </label>'+
'<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 class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>: </label>'+
2015-11-20 17:25:03 +08:00
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,B,C, 在答案输入框填入ABC即可" type="text">'+
2015-11-19 14:35:51 +08:00
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
2015-11-20 20:44:27 +08:00
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
2015-11-19 14:35:51 +08:00
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
2015-11-20 17:25:03 +08:00
$("#poll_questions_title").focus();
2015-11-19 14:35:51 +08:00
}
}else {
2015-11-19 11:37:49 +08:00
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
}
</script>