测验的题干改成ke

This commit is contained in:
cxt 2017-10-18 16:03:32 +08:00
parent c04200804d
commit 721792a849
20 changed files with 540 additions and 303 deletions

View File

@ -30,9 +30,10 @@
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 625px;" 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 style="width: 625px;" class="fl"><textarea id="poll_questions_title_<%= exercise_question.id %>" name="question_title" class="undis"><%= exercise_question.question_title.html_safe %></textarea></div>
<div class="cl"></div>
</div>
<div class="ur_editor_content">

View File

@ -30,9 +30,10 @@
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 625px;" 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 style="width: 625px;" class="fl"><textarea id="poll_questions_title_<%= exercise_question.id %>" name="question_title" class="undis"><%= exercise_question.question_title.html_safe %></textarea></div>
<div class="cl"></div>
</div>
<div class="ur_editor_content">

View File

@ -14,9 +14,10 @@
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8 ml25 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 600px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入问答题的题干" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
<div style="width: 600px;" class="fl"><textarea id="poll_questions_title_<%= exercise_question.id %>" name="question_title" class="undis"><%= exercise_question.question_title.html_safe %></textarea></div>
<div class="cl"></div>
</div>
<div class="ur_editor_content" id="edit_multi">

View File

@ -26,9 +26,10 @@
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8 ml36 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 590px;" 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 style="width: 590px;" class="fl"><textarea id="poll_questions_title_<%= exercise_question.id %>" name="question_title" class="undis"><%= exercise_question.question_title.html_safe %></textarea></div>
<div class="cl"></div>
</div>
<div class="ur_editor_content" id="edit_single">

View File

@ -82,6 +82,7 @@
//添加标题时确定按钮
function add_poll_question(doc,quest_type)
{
new_quetion_title_editor.sync();
var title = $.trim($("#poll_questions_title").val());
var score = $.trim($("#question_score").val());
var standard_ans = $.trim($("#exercise_choice_" + quest_type).val());
@ -106,6 +107,7 @@
//修改标题时确定按钮
function edit_poll_question(doc,id,quest_type)
{
edit_quetion_title_editor.sync();
var title = $.trim($("#poll_questions_title_" + id).val());
var score = $.trim($("#poll_question_score_"+ id).val());
var standard_ans = $.trim($("#exercise_choice_" + id).val());
@ -164,9 +166,36 @@
$("#edit_poll_questions_"+question_id).hide();
}
function pollQuestionEdit(question_id){
$("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
var forms = $("form.new_exercise_question");
if($.trim($("#insert_new_poll_question_"+question_id).html()) == "") {
if(forms.length > 0){
notice_box("请先保存正在编辑的题目再编辑。");
} else{
$("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
KindEditor.ready(function(K){
$("div#edit_poll_questions_"+question_id).each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.placeholder = "请输入题干";
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
edit_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
} else{
notice_box("请先保存正在编辑的题目再编辑。");
}
}
// 选项的选择
function toggle_select(doc, type, id){

View File

@ -83,7 +83,7 @@
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
第<%= list_index+1%>题:<%= exercise_question.question_title.html_safe %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="exercise_inputs">
@ -143,7 +143,7 @@
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
第<%= list_index+1%>题:<%= exercise_question.question_title.html_safe %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="exercise_inputs">
@ -210,7 +210,7 @@
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == single_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
第<%= list_index+1%>题:<%= exercise_question.question_title.html_safe %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div>
@ -254,7 +254,7 @@
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
第<%= list_index+1%>题:<%= exercise_question.question_title.html_safe %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div>

View File

@ -53,7 +53,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
@ -100,7 +100,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
@ -146,7 +146,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
@ -194,7 +194,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
<% if exercise_question.exercise_standard_answers.count > 0 %>

View File

@ -39,7 +39,7 @@
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
<div class="exercise_inputs">
@ -75,7 +75,7 @@
标准答案:<%= exercise_question.exercise_standard_answers.empty? ? "" : convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
<div class="exercise_inputs">
@ -110,7 +110,7 @@
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分</span>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
<div>
@ -134,7 +134,7 @@
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分</span>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="cl"></div>
<% if exercise_question.exercise_standard_answers.count > 0 %>

View File

@ -1,70 +1,75 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% 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: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">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></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 nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% 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: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 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<div style="width: 648px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div>
<div class="cl"></div>
</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();">取消</a>
</div>
<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();">取消</a>
</div>
<div class="cl"></div>
<% end %>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),1);
});
});
$(function () {
$("#add_new_question").one('click', function () {
add_poll_question($(this), 1);
});
});
</script>

View File

@ -1,69 +1,74 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% 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:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="2" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">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 nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% 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:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>
<span class="fr">标准答案:</span>
<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), 2, 2);">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>
<div class="ur_editor_title">
<label class="questionLabel mt8 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="2" type="hidden">
<div style="width: 648px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div>
<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), 2, 2);">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), 2, 2);">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), 2);'>新建选项</div>
</li>
<div class='cl'></div>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">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), 2, 2);">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), 2, 2);">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), 2, 2);">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), 2);'>新建选项</div>
</li>
<div class='cl'></div>
</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();">取消</a>
</div>
<div class="cl"></div>
</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();">取消</a>
</div>
<div class="cl"></div>
<% end %>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),2);
$(function () {
$("#add_new_question").one('click', function () {
add_poll_question($(this), 2);
});
});
</script>

View File

@ -1,38 +1,41 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="4" type="hidden">
<textarea maxlength="250" style="width: 619px;" 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_multi">
<div nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "" : exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%= score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="4" type="hidden">
<div style="width: 622px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div>
<div class="cl"></div>
</div>
<div class="ur_editor_content" id="new_multi">
<div class="multi_input">
<label name='candiate_items'>参考答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<textarea class="candiate_answer" style="width: 620px; height: 90px;" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" type="text"></textarea>
</div>
<div class="cl"></div>
</div>
<div class="ur_editor_footer">
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
<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();">取消</a>
</div>
<div class="cl"></div>
</div>
<div class="ur_editor_footer">
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
<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();">取消</a>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),4);
$(function () {
$("#add_new_question").one('click', function () {
add_poll_question($(this), 4);
});
});
</script>

View File

@ -1,3 +1,6 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<ul class="tabs_list">
<li class="tab_item02 mr27"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
<li class="tab_item02 mr27"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
@ -5,8 +8,29 @@
<li class="tab_item02 "> <a title="问答题" class="tab_icon icon_text" onclick="add_multi();"> 新建问答题 </a> </li>
</ul>
<div class="cl"></div>
<div id="hidden_div_block" class="undis">
<textarea style="display: none" id="hidden_textarea"></textarea>
</div>
<script type="text/javascript">
$(function(){
KindEditor.ready(function(K){
$("#hidden_div_block").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.placeholder = "请输入单选题的题干";
params.textarea = $("#hidden_textarea",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
//new_quetion_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
});
function add_MC(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
@ -15,7 +39,24 @@
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入单选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}
@ -27,7 +68,24 @@
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入多选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}
@ -39,7 +97,24 @@
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入填空题的题干(注意:目前仅支持一个空)";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}
@ -51,7 +126,24 @@
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入简答题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}

View File

@ -1,60 +1,63 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<textarea maxlength="250" style="width: 608px;" 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>
<div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[0]" placeholder="请输入参考答案" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "" : exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%= score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[1]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36 fl">问题:&nbsp;&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<div style="width: 612px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[2]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
</li>
<div class='cl'></div>
</div>
<div class="ur_editor_content" id="new_single">
<ul>
<div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[0]" placeholder="请输入参考答案" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[1]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[2]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</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();">取消</a>
</div>
<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();">取消</a>
</div>
<div class="cl"></div>
<% end %>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),3);
$(function () {
$("#add_new_question").one('click', function () {
add_poll_question($(this), 3);
});
});
</script>

View File

@ -19,7 +19,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="exercise_inputs">
@ -40,20 +40,20 @@
</div>
</div><!--单选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
<div id="insert_new_poll_question_<%=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($.trim($("#insert_new_poll_question_"+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|%>'+
$("#insert_new_poll_question_"+quest_id).html(
'<div nhname="new_exercise_mc_q"><%= 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>&nbsp;&nbsp;&nbsp;</label>'+
@ -63,11 +63,11 @@
'<div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_title"> '+
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<label class="questionLabel fl mt8">问题:&nbsp;&nbsp;&nbsp;</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 style="width: 625px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div><div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
@ -117,21 +117,34 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
'<% end%></div>'
);
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入单选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
new_quetion_title_editor.focus();
params.textarea.data('init', 1);
}
});
});
$("#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("");
$("#insert_new_poll_question_"+quest_id).html("");
}
}
</script>

View File

@ -19,7 +19,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div class="exercise_inputs">
@ -40,19 +40,19 @@
</div>
</div><!--多选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
<div id="insert_new_poll_question_<%=exercise_question.id%>">
</div>
<script type="text/javascript">
function insert_MCQ(quest_type,quest_num,quest_id){
var forms = $("form.new_exercise_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
if($.trim($("#insert_new_poll_question_"+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|%>'+
$("#insert_new_poll_question_"+quest_id).html(
'<div nhname="new_exercise_mc_q"><%= 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>&nbsp;&nbsp;&nbsp;</label>'+
@ -62,11 +62,11 @@
'<div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_title">'+
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<label class="questionLabel mt8 fl">问题:&nbsp;&nbsp;&nbsp;</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"/>'+
'<textarea name="question_title" style="width: 625px;" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text"></textarea>'+
'<div style="width: 625px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div><div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
@ -114,20 +114,33 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
'<% end%></div>'
);
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入单选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
new_quetion_title_editor.focus();
params.textarea.data('init', 1);
}
});
});
$("#add_new_question").one('click', function(){
add_poll_question($(this),2);
});
$(".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("");
$("#insert_new_poll_question_"+quest_id).html("");
}
}
</script>

View File

@ -18,7 +18,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<% if exercise_question.exercise_standard_answers.count > 0 %>
@ -28,19 +28,19 @@
<% end %>
</div>
<!-- 新增问题 -->
<div id="insert_new_poll_question_multi_<%=exercise_question.id%>">
<div id="insert_new_poll_question_<%=exercise_question.id%>">
</div>
<script type="text/javascript">
function insert_MULTI(quest_type,quest_num,quest_id){
var forms = $("form.new_exercise_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if($.trim($("#insert_new_poll_question_"+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|%>'+
$("#insert_new_poll_question_"+quest_id).html(
'<div nhname="new_exercise_mc_q"><%= 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 class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
@ -48,11 +48,11 @@
'<div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_title"> '+
'<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;&nbsp;</label>'+
'<label class="questionLabel mt8 ml25 fl">问题:&nbsp;&nbsp;&nbsp;</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="4"/>'+
'<textarea maxlength="250" style="width: 600px;" name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入问答题的题干" type="text"></textarea>'+
'<div style="width: 600px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div><div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_content" id="new_multi">'+
'<div class="multi_input">'+
@ -72,20 +72,33 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
'<% end%></div>'
);
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入简答题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
new_quetion_title_editor.focus();
params.textarea.data('init', 1);
}
});
});
$("#add_new_question").one('click', function(){
add_poll_question($(this),4);
});
$(".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("");
$("#insert_new_poll_question_"+quest_id).html("");
}
}
</script>

View File

@ -18,7 +18,7 @@
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<div class="break_word"><%= exercise_question.question_title.html_safe %></div>
</div>
<div>
@ -28,19 +28,19 @@
</div>
</div>
<!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=exercise_question.id%>">
<div id="insert_new_poll_question_<%=exercise_question.id%>">
</div>
<script type="text/javascript">
function insert_SINGLE(quest_type,quest_num,quest_id){
var forms = $("form.new_exercise_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if($.trim($("#insert_new_poll_question_"+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|%>'+
$("#insert_new_poll_question_"+quest_id).html(
'<div nhname="new_exercise_mc_q"><%= 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 class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
@ -48,11 +48,11 @@
'<div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_title"> '+
'<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;&nbsp;</label>'+
'<label class="questionLabel mt8 ml36 fl">问题:&nbsp;&nbsp;&nbsp;</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="3"/>'+
'<textarea maxlength="250" style="width: 590px;" name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text"></textarea>'+
'<div style="width: 590px;" class="fl"><textarea id="poll_questions_title" name="question_title" class="undis"></textarea></div><div class="cl"></div>'+
'</div>'+
'<div class="ur_editor_content" id="new_single">'+
'<ul>'+
@ -94,20 +94,33 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
'<% end%></div>'
);
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入填空题的题干(注意:目前仅支持一个空)";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
new_quetion_title_editor.focus();
params.textarea.data('init', 1);
}
});
});
$("#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("");
$("#insert_new_poll_question_"+quest_id).html("");
}
}
</script>

View File

@ -49,7 +49,7 @@
<script type="text/javascript">
$(function(){
<% if (!@exercise.time.nil? && @exercise.time != -1) || Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<%# if (!@exercise.time.nil? && @exercise.time != -1) || Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){
@ -58,12 +58,12 @@
$(".student_work_<%= exercise.id%>").on('click',function() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
});
<% else %>
<%# else %>
//$("#show_student_result_div_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$(".student_work_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
// $(".student_work_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_id_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
//$("#student_class_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<%# end %>
});
/*function show_result(id) {
window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';

View File

@ -1,12 +1,10 @@
<% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
<% current_score = get_current_score @exercise %>
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>");
<% else %>
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>');
$("#new_poll_question").html("");
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
<%if @exercise_questions.question_type == 1%>
$("#mc_question_list>div").last().children().first().addClass("border_b");
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +

View File

@ -2294,3 +2294,49 @@ function is_IE(){
}
}
function init_exercise_quetison_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"74px",height:"74px",
items : ['code','emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
afterChange:function(){//按键事件
var edit = this.edit;
var body = edit.doc.body;
edit.iframe.height(48);
//this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight+30 : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight+30)), 48));
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+30, 48));
},
afterBlur:function(){
params.textarea.blur();
if(this.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*[\]*[\]*[\u4e00-\u9fa5]*[\]*[\u4e00-\u9fa5]*[\。]*[\]*<\/\w*\>\s*$/.test(this.edit.html())) {
this.edit.html("<span id='hint' style='color:#999999;font-size:12px;'>"+params.placeholder+"</span>");
this.resize("100%", null);
}
},
afterFocus: function(){
var edit = this.edit;
var body = edit.doc.body;
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*[\]*[\]*[\u4e00-\u9fa5]*[\]*[\u4e00-\u9fa5]*[\。]*[\]*<\/\w*\>\s*$/.test(edit.html())){
edit.html("");
}
this.resize("100%", null);
},
afterCreate:function(){
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
edit.html(params.textarea.innerHTML);
if(this.isEmpty()) {
edit.html("<span id='hint' style='color:#999999;font-size:12px;'>"+params.placeholder+"</span>");
}
}
}).loadPlugin('paste');
//editor.focus();
return editor;
}