150 lines
7.0 KiB
Plaintext
150 lines
7.0 KiB
Plaintext
<% 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>
|
|
<li class="tab_item02 mr27"> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
|
|
<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")){
|
|
notice_box("请先保存测验标题及测验基本信息。");
|
|
}else if(forms.length > 0){
|
|
notice_box("请先保存正在编辑的题目再新建。");
|
|
} else{
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
|
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);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
function add_MCQ(){
|
|
var forms = $("form.new_exercise_question");
|
|
if($("#polls_head_edit").is(":visible")){
|
|
notice_box("请先保存测验标题及测验基本信息。");
|
|
}else if(forms.length > 0){
|
|
notice_box("请先保存正在编辑的题目再新建。");
|
|
} else{
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
|
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);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
function add_single(){
|
|
var forms = $("form.new_exercise_question");
|
|
if($("#polls_head_edit").is(":visible")){
|
|
notice_box("请先保存测验标题及测验基本信息。");
|
|
}else if(forms.length > 0){
|
|
notice_box("请先保存正在编辑的题目再新建。");
|
|
} else{
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
|
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);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
function add_multi(){
|
|
var forms = $("form.new_exercise_question");
|
|
if($("#polls_head_edit").is(":visible")){
|
|
notice_box("请先保存测验标题及测验基本信息。");
|
|
}else if(forms.length > 0){
|
|
notice_box("请先保存正在编辑的题目再新建。");
|
|
} else{
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>exercise}) %>");
|
|
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);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
</script> |