填空题

This commit is contained in:
cxt 2015-11-18 16:51:47 +08:00
parent f850a71b59
commit d407610740
9 changed files with 63 additions and 16 deletions

View File

@ -61,7 +61,12 @@
function insert_MC(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%#= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@exercise.id),:remote => true do |f|%>'+
'<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'create_exercise_question',
:course_id => @course.id
},:remote=>true ) do |f|%>'+
' <div class="ur_editor radio"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
@ -107,7 +112,7 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
'<% end%>'
);
$("#poll_questions_title").focus();
}
@ -119,7 +124,12 @@
function insert_MCQ(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%#= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@exercise.id),:remote => true do |f|%>'+
'<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'create_exercise_question',
:course_id => @course.id
},:remote=>true ) do |f|%>'+
'<div class="ur_editor checkbox">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
@ -165,7 +175,7 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
'<% end%>'
);
$("#poll_questions_title").focus();
}
@ -177,7 +187,12 @@
function insert_SINGLE(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%#= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@exercise.id),:remote => true do |f|%>'+
'<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'create_exercise_question',
:course_id => @course.id
},:remote=>true ) do |f|%>'+
'<div class="ur_editor text ">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
@ -198,7 +213,7 @@
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
'<% end%>'
);
$("#poll_questions_title").focus();
}

View File

@ -47,7 +47,7 @@
<div class="cl"></div>
<li class="ur_item">
<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input name="exercise_choice" placeholder="若标准答案为AB,C在答案输入框填入ABC即可" type="text">
<input name="exercise_choice" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text">
</li>
<div class="cl"></div>
</ul>

View File

@ -1,8 +1,14 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'create_exercise_question',
:course_id => @course.id
},:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<input maxlength="250" class="questionTitle" name="questions_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text">
<input maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text">
</div>
<div class="ur_editor_content">
<ul>
@ -33,4 +39,5 @@
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
</div>
<div class="cl"></div>
</div>
</div>
<% end %>

View File

@ -4,7 +4,7 @@
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
</div>
<%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
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>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=exercise_question.id%>" onclick="chooseQuestionType('mc',<%=exercise_question.id%>);"></a>
@ -31,8 +31,8 @@
</div>
<div id="div_mc_<%=exercise_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=exercise_question.id%>);insert_MC('mc',<%=exercise_question.question_number%>,<%=exercise_question.id%>);">单选</a></li>
<!--<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%#=poll_question.id%>);insert_MCQ('mc',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">多选</a></li>
<!--<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%#=exercise_question.id%>);insert_MC('mc',<%#=exercise_question.question_number%>,<%#=exercise_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%#=poll_question.id%>);insert_MCQ('mc',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%#=poll_question.id%>);insert_SINGLE('mc',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单行主观</a></li>-->
</ul>
</div>

View File

@ -3,7 +3,7 @@
<%= exercise_question.question_title %>
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
</div>
<%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
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>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=exercise_question.id%>" onclick="chooseQuestionType('mcq',<%=exercise_question.id%>);"></a>
@ -32,9 +32,7 @@
<ul>
<!--
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_MC('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单选</a></li>
-->
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=exercise_question.id%>);insert_MCQ('mcq',<%=exercise_question.question_number%>,<%=exercise_question.id%>);">多选</a></li>
<!--
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=exercise_question.id%>);insert_MCQ('mcq',<%#=exercise_question.question_number%>,<%#=exercise_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_SINGLE('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单行主观</a></li>
-->
</ul>

View File

@ -0,0 +1,25 @@
<div>
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
</div>
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
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>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=exercise_question.id%>" onclick="chooseQuestionType('single',<%=exercise_question.id%>);"></a>
<div class="cl"></div>
<div>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
候选答案:<%= exercise_choice.choice_text%><br />
<% end %>
</div>
</div>
<!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=exercise_question.id%>">
</div>
<div id="div_single_<%=exercise_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<!--<li><a href="javascript:void(0);" onclick=" dismiss('single',<%#=poll_question.id%>);insert_MC('single',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%#=poll_question.id%>);insert_MCQ('single',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%#=poll_question.id%>);insert_SINGLE('single',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单行主观</a></li>-->
</ul>
</div>

View File

@ -0,0 +1 @@
$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>");

View File

@ -156,6 +156,7 @@ RedmineApp::Application.routes.draw do
end
collection do #生成路径为 /exercise/方法名
delete 'delete_exercise_question'
end
end