Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
83c7e981af
|
@ -299,16 +299,21 @@ class ExerciseController < ApplicationController
|
||||||
|
|
||||||
# 发布试卷
|
# 发布试卷
|
||||||
def publish_exercise
|
def publish_exercise
|
||||||
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||||
@exercise.exercise_status = 2
|
@exercise.exercise_status = 2
|
||||||
@exercise.publish_time = Time.now
|
@exercise.publish_time = Time.now
|
||||||
if @exercise.save
|
if @exercise.save
|
||||||
redirect_to exercise_index_url(:course_id=> @course.id)
|
#redirect_to exercise_index_url(:course_id=> @course.id)
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# 重新发布试卷
|
# 重新发布试卷
|
||||||
# 重新发布的时候会删除所有的答题
|
# 重新发布的时候会删除所有的答题
|
||||||
def republish_exercise
|
def republish_exercise
|
||||||
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||||
@exercise.exercise_questions.each do |exercise_question|
|
@exercise.exercise_questions.each do |exercise_question|
|
||||||
exercise_question.exercise_answers.destroy_all
|
exercise_question.exercise_answers.destroy_all
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,1);">
|
||||||
保存
|
保存
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
|
||||||
保存
|
保存
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,3);">
|
||||||
保存
|
保存
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||||
|
|
|
@ -80,29 +80,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加标题时确定按钮
|
//添加标题时确定按钮
|
||||||
function add_poll_question(doc,quest_type,quest_id)
|
function add_poll_question(doc,quest_type)
|
||||||
{
|
{
|
||||||
var title = $.trim($("#poll_questions_title").val());
|
var title = $.trim($("#poll_questions_title").val());
|
||||||
var score = $.trim($("#question_score").val());
|
var score = $.trim($("#question_score").val());
|
||||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||||
if(title.length == 0 || score.length == 0){
|
if(title.length == 0 || score.length == 0){
|
||||||
alert("题目标题/分数不能为空");
|
alert("题目标题/分数不能为空");
|
||||||
}/*else if(standard_ans.length == 0) {
|
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||||
alert("标准答案不能为空");
|
alert("标准答案不能为空");
|
||||||
}*/else{
|
}else{
|
||||||
doc.parent().parent().parent().submit();}
|
doc.parent().parent().parent().submit();}
|
||||||
}
|
}
|
||||||
//修改标题时确定按钮
|
//修改标题时确定按钮
|
||||||
function edit_poll_question(doc,id)
|
function edit_poll_question(doc,id,quest_type)
|
||||||
{
|
{
|
||||||
var title = $.trim($("#poll_questions_title_" + id).val());
|
var title = $.trim($("#poll_questions_title_" + id).val());
|
||||||
var score = $.trim($("#poll_question_score_"+ id).val());
|
var score = $.trim($("#poll_question_score_"+ id).val());
|
||||||
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
|
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
|
||||||
if(title.length == 0 || score.length == 0){
|
if(title.length == 0 || score.length == 0){
|
||||||
alert("题目标题/分数不能为空");
|
alert("题目标题/分数不能为空");
|
||||||
}/*else if(standard_ans.length == 0) {
|
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||||
alert("标准答案不能为空");
|
alert("标准答案不能为空");
|
||||||
}*/else{
|
}else{
|
||||||
doc.parent().parent().parent().submit();}
|
doc.parent().parent().parent().submit();}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
<input class="fillInput" placeholder="在此填入答案" type="text" value="" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<%= radio_button "poll_vote","poll_answer_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div id="polls_list" class="polls_list">
|
<div id="polls_list" class="polls_list">
|
||||||
|
|
||||||
<% @exercises.each do |exercise|%>
|
<% @exercises.each do |exercise|%>
|
||||||
<ul id="polls_<%= exercise.id %>" class="polls_list_ul">
|
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
|
||||||
<%= render :partial => 'exercise', :locals => {:exercise => exercise} %>
|
<%= render :partial => 'exercise', :locals => {:exercise => exercise} %>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function add_MC(){
|
function add_MC(){
|
||||||
var forms = $("form.new_exercise_question");
|
var forms = $("form.new_exercise_question");
|
||||||
if(forms.length > 0){
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
alert("请先保存正在编辑的题目再新建。");
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
} else{
|
} else{
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
||||||
|
@ -18,7 +20,9 @@
|
||||||
|
|
||||||
function add_MCQ(){
|
function add_MCQ(){
|
||||||
var forms = $("form.new_exercise_question");
|
var forms = $("form.new_exercise_question");
|
||||||
if(forms.length > 0){
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
alert("请先保存正在编辑的题目再新建。");
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
} else{
|
} else{
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
||||||
|
@ -28,7 +32,9 @@
|
||||||
|
|
||||||
function add_single(){
|
function add_single(){
|
||||||
var forms = $("form.new_exercise_question");
|
var forms = $("form.new_exercise_question");
|
||||||
if(forms.length > 0){
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
alert("请先保存正在编辑的题目再新建。");
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
} else{
|
} else{
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||||
"<div class='upload_con'>" +
|
"<div class='upload_con'>" +
|
||||||
"<div class='upload_box'>" +
|
"<div class='upload_box'>" +
|
||||||
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
|
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
|
||||||
"<div class='polls_btn_box'>" +
|
"<div class='polls_btn_box'>" +
|
||||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise_content',:locals => {:exercise => @exercise}) %>");
|
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||||
showModal('ajax-modal', '250px');
|
showModal('ajax-modal', '250px');
|
||||||
//$('#ajax-modal').css('height','80px');
|
//$('#ajax-modal').css('height','80px');
|
||||||
|
|
Loading…
Reference in New Issue