129 lines
8.8 KiB
Plaintext
129 lines
8.8 KiB
Plaintext
<div onmouseover="$('#menu_div_<%= exercise_question.id %>').show();" onmouseout="$('#menu_div_<%= exercise_question.id %>').hide();">
|
||
<div class="exercise_title">
|
||
<div>
|
||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||
<div class="fr none" id="menu_div_<%= exercise_question.id %>">
|
||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||
<%= 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 => "删除") %>
|
||
<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>
|
||
<div class="cl"></div>
|
||
</div>
|
||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||
</div>
|
||
|
||
<div class="exercise_inputs">
|
||
<table class="" style="width:100%;">
|
||
<tbody>
|
||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||
<tr>
|
||
<td>
|
||
<label>
|
||
<input class="ur_radio" type="radio" 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_mc_<%=exercise_question.id%>">
|
||
</div>
|
||
<div class="cl"></div>
|
||
|
||
<script type="text/javascript">
|
||
function insert_MC(quest_type,quest_num,quest_id){
|
||
var forms = $("form.new_exercise_question");
|
||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||
if(forms.length > 0){
|
||
notice_box("请先保存正在编辑的题目再新建。");
|
||
} else{
|
||
<% score =exercise_question.question_score %>
|
||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||
' <div class="questionContainer" style="width: 680px;"> '+
|
||
'<div class="mb10 ur_item">'+
|
||
'<label>分值<span class="ur_index"></span>: </label>'+
|
||
'<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分'+
|
||
'<span class="fr c_red" style="width: 60px;" id="question_standard_answer_1">请点击选项</span>'+
|
||
'<span class="fr">标准答案:</span>'+
|
||
'<div class="cl"></div>'+
|
||
'</div>'+
|
||
'<div class="ur_editor_title"> '+
|
||
'<label class="questionLabel mt8">问题: </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="1"/>'+
|
||
'<textarea name="question_title" style="width: 625px;" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text"></textarea>'+
|
||
'</div>'+
|
||
'<div class="ur_editor_content">'+
|
||
'<ul>'+
|
||
'<div>'+
|
||
'<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>'+
|
||
'<li class="ur_item new_answer">'+
|
||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">A</a>'+
|
||
'<input maxlength="200" class="w600" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||
'</li>'+
|
||
'<div class="cl"></div>'+
|
||
'<li class="ur_item new_answer">'+
|
||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">B</a>'+
|
||
'<input maxlength="200" class="w600" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||
'</li>'+
|
||
'<div class="cl"></div>'+
|
||
'<li class="ur_item new_answer">'+
|
||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">C</a>'+
|
||
'<input maxlength="200" class="w600" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||
'</li>'+
|
||
'<div class="cl"></div>'+
|
||
'<li class="ur_item new_answer">'+
|
||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">D</a>'+
|
||
'<input maxlength="200" class="w600" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||
'</li>'+
|
||
'<div class="cl"></div>'+
|
||
'<li class="ur_item">'+
|
||
'<a class="question_choice_dash fl mr10 choice_btn">E</a>'+
|
||
'<div class="dash-block new-question w600" onclick="add_single_answer($(this), 1);">新建选项</div>'+
|
||
'</li>'+
|
||
'<div class="cl"></div>'+
|
||
'</div>'+
|
||
'<div class="cl"></div>'+
|
||
'</ul>'+
|
||
'</div>'+
|
||
'<div class="ur_editor_footer">'+
|
||
'<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>'+
|
||
'<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">'+
|
||
'保存'+
|
||
'</a>'+
|
||
'<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||
'<%= l(:button_cancel)%>'+
|
||
'</a>'+
|
||
'</div>'+
|
||
'<div class="cl"></div>'+
|
||
'</div>'+
|
||
'<% end%>'
|
||
);
|
||
$("#poll_questions_title").focus();
|
||
$("#add_new_question").one('click', function(){
|
||
add_poll_question($(this),1);
|
||
});
|
||
$(".questionTitle").on("input",function(){
|
||
$(this).height(30);
|
||
var scrollVal = $(this)[0].scrollHeight;
|
||
$(this).height(scrollVal);
|
||
});
|
||
}
|
||
}
|
||
else {
|
||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||
}
|
||
}
|
||
</script> |