在线测验问答题支持回车

This commit is contained in:
Tim 2016-10-25 15:55:48 +08:00
parent 5b2df31c95
commit d44744cfd7
3 changed files with 13 additions and 8 deletions

View File

@ -3,7 +3,6 @@
<script type="text/javascript">
function resetQuestion<%=exercise_question.id%>()
{
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
$("#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| %>" +
"<li class='ur_item'>" +
@ -20,9 +19,9 @@
<div class="questionContainer" style="width: 680px;">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" value="<%=exercise_question.question_title %>">
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<div class="ur_editor_content" id="edit_single">
<ul>

View File

@ -4,9 +4,9 @@
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<input maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text">
<textarea maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content" id="new_single">
<ul>

View File

@ -1,6 +1,7 @@
<div>
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
<div class="testEditTitle">
<div>第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)</div>
<span class="formatContainer break_word"><%= exercise_question.question_title %></span>
</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 => "删除") %>
@ -33,7 +34,7 @@
'<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="3"/>'+
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
'<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"></textarea>'+
'</div>'+
'<div class="ur_editor_content" id="new_single">'+
'<ul>'+
@ -80,6 +81,11 @@
$("#add_new_question").one('click', function(){
add_poll_question($(this),3);
});
$(".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("");