Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
1d5ae6d561
|
@ -54,4 +54,15 @@ module ExerciseHelper
|
|||
return result
|
||||
end
|
||||
|
||||
def get_current_score exercise
|
||||
score = 0
|
||||
unless exercise.nil?
|
||||
exercise.exercise_questions.each do |exercise_question|
|
||||
score += exercise_question.question_score
|
||||
end
|
||||
return score
|
||||
end
|
||||
return score
|
||||
end
|
||||
|
||||
end
|
|
@ -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>问题: </label>'+
|
||||
|
@ -76,21 +81,21 @@
|
|||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
|
@ -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>问题: </label>'+
|
||||
|
@ -134,21 +144,21 @@
|
|||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
|
@ -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">问题: </label>'+
|
||||
|
@ -198,7 +213,7 @@
|
|||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<%# end%>'
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
|
@ -274,7 +289,7 @@
|
|||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
|
@ -319,7 +334,8 @@
|
|||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<div class="mb5" style="display: none">目前试卷总分:<span class="c_red">20分</span></div>
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>">目前试卷总分:<span class="c_red" id="current_score"><%=current_score %>分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
|
||||
|
|
|
@ -18,29 +18,29 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'>
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'>
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='新建选项'/>
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
|
@ -18,36 +18,36 @@
|
|||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'>
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'>
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'>
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='新建选项'>
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">
|
||||
<input name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
|
|
@ -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>问题: </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 %>
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -23,4 +23,5 @@ $("#poll_content").append("<div id='poll_questions_<%= @exercise_questions.id%>'
|
|||
"<% end%>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>");
|
|
@ -156,6 +156,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
collection do #生成路径为 /exercise/方法名
|
||||
delete 'delete_exercise_question'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue