Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

Conflicts:
	app/controllers/exercise_controller.rb
处理冲突
This commit is contained in:
huang 2015-11-17 15:22:31 +08:00
commit 651f6565be
12 changed files with 580 additions and 35 deletions

View File

@ -36,18 +36,9 @@ class ExerciseController < ApplicationController
end
def new
option = {
:exercise_name => "",
:exercise_description => "",
:course_id => @course.id,
:exercise_status => 1,
:user_id => User.current.id,
:time => "",
:end_time => ""
}
@exercise = Exercise.create option
if @exercise
redirect_to edit_exercise_url @exercise.id
@exercise = Exercise.new
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
end
@ -56,7 +47,9 @@ class ExerciseController < ApplicationController
end
def edit
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
end
def update
@ -155,6 +148,7 @@ class ExerciseController < ApplicationController
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S"))
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
@show_all = true;
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S")
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
else

View File

@ -0,0 +1,24 @@
<div class="testContainer">
<div>
<input class="testTitle mb10" type="text" placeholder="测验标题" />
</div>
<%# if edit_mode %>
<!--<label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label>-->
<%# end %>
<div class="calendar_div fl mr10">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%>
</div>
<%# if edit_mode %>
<!--<label class="fl c_grey f14" style="margin-top: 4px;">发布日期(可选)</label>-->
<%# end %>
<div class="calendar_div fl">
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<%= calendar_for('homework_publish_time')%>
</div>
<div class="fl ml10 f14 fontGrey2"><span class="mr5">考试时长:</span><input type="text" class="examTime mr5" />分钟</div>
<div class="cl"></div>
<textarea class="testDes mt10" placeholder="发布须知试题类型有选择和填空两种其中选择题包括单选题和多选题。多选题的答案格式为若标准答案为A,B,C在答案输入框填入ABC即可。填空题问题格式为”电脑的核心部件是”根据问题设置与答案相关的关键词系统会根据关键词匹配学生上交的答案关键词可设置多个。谢谢您的配合您可以在此处填写测验相关说明。" ></textarea>
<a href="javascript:void(0);" class="btn_submit c_white" >保存</a> <a href="javascript:void(0);" class="btn_cancel" >取消</a>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,23 @@
<% poll.exercise_questions.each do |poll_question|%>
<div id="poll_questions_<%= poll_question.id%>">
<!--<div id="show_poll_questions_<%= poll_question.id %>">
<%# if poll_question.question_type == 1%>
<%#= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %>
<%# elsif poll_question.question_type == 2%>
<%#= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
<%# elsif poll_question.question_type == 3%>
<%#= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
<%# end%>
</div>-->
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<% if poll_question.question_type == 1%>
<%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 2%>
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 3%>
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
<% end%>
</div>
</div>
<% end %>

View File

@ -0,0 +1,333 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
$("#Container").css("width","1000px");
});
//编辑问卷描述之后
var popWindow ; //弹出框的引用
var importPollPopWindow; //选择导入的弹出框引用
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
$(function(){
//点击空白处
$(document).bind('click',function(e){
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
popWindow.css('display', 'none');
}
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
importPollPopWindow.css('display', 'none');
}
});
})
function dismiss(quest_type,quest_id){
popWindow = $("#div_"+quest_type+"_"+quest_id);
if(popWindow){
popWindow.css('display', 'none');
}
}
function chooseQuestionType(quest_type,quest_id){
//quest_type 分为 mc mcq single multi
//quest_id 是quetion的id 下同
if(popWindow){
popWindow.css('display', 'none');
}
popWindow = $("#div_"+quest_type+"_"+quest_id);
$("#div_"+quest_type+"_"+quest_id).click(function(e){
e.stopPropagation(); //组织冒泡到document.body中去
});
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
}
else{
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
}
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
}
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|%>'+
' <div class="ur_editor radio"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&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"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</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>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
);
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
}
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|%>'+
'<div class="ur_editor checkbox">'+
'<div class="ur_editor_title">'+
'<label>问题:&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"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</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>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
);
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
}
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|%>'+
'<div class="ur_editor text ">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&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"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<%# end%>'
);
$("#poll_questions_title").focus();
}
//选择导入调查问卷
function importPoll(){
importPollPopWindow = $("#import_poll");
$("#import_poll").css("position", "absolute");
$("#import_poll").css("top", $("#import_btn").offset().top+30);
$("#import_poll").css("left", $("#import_btn").offset().left-65);
$("#import_poll").css("display","block")
}
function remote_import(){
importPollPopWindow.css('display', 'none');
if($("#import_poll").val() === 0){
return;
}else{
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
$("#import_form").submit();
}else{
return;
}
}
}
//添加标题时确定按钮
function add_poll_question(doc)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
{
var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){
var title = $.trim($("#polls_title").val());
if(title.length == 0){alert("测验标题不能为空");}else{doc.parent().parent().parent().submit();}
}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//
function pollQuestionCancel(question_id){
$("#show_poll_questions_"+question_id).show();
$("#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();
}
//单选题
function add_single_answer(doc)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</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>");
}
function remove_single_answer(doc)
{
if(doc.parent().siblings("li").length == 0)
{
alert("选择题至少有一个选项");
}
else
{
doc.parent().remove();
}
}
function poll_submit()
{
var title = $.trim($("#polls_name_h").html());
if(title.length == 0)
{
alert("测验标题不能为空");
}
else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @exercise,:is_remote => false}) %>');
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
}
</script>
<div class="homepageRight mt0 ml10">
<div class="resources">
<!-- 头部 -->
<div id="polls_head_show" style="display: none;">
<%#= render :partial => 'show_head', :locals => {:poll => @exercise}%>
</div>
<div id="polls_head_edit">
<%= render :partial => 'edit_head', :locals => {:poll => @exercise}%>
</div>
<!-- 问题 -->
<div id="poll_content">
<%= render :partial => 'exercise_content', :locals => {:poll => @exercise}%>
</div>
<div class="testQuestion">
<ul class="tabs_list">
<li class="tab_item02 mr118"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
<li class="tab_item02 mr118"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
<li class="tab_item02 "> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
</ul>
<div class="cl"></div>
</div><!--选项 end-->
<div class="ur_buttons"> <a class="ur_button_submit" onclick="poll_submit();"> 发布 </a>
<div class="polls_cha">
<input name="" value="" type="checkbox">
<label for="">允许学生查看测验结果</label>
</div>
</div>
<div class="cl"></div>
<!--contentbox end-->
</div>
</div><!--编辑end-->

View File

@ -0,0 +1,38 @@
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<input class="questionTitle" placeholder="请输入单选题题目" type="text">
</div>
<div class="ur_editor_content">
<ul>
<li class="ur_item">
<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="若标准答案为A在此输入A即可" type="text">
</li>
<div class="cl"></div>
</ul>
</div>
<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_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a> </div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,39 @@
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<input class="questionTitle" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目" type="text">
</div>
<div class="ur_editor_content">
<ul>
<li class="ur_item">
<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="新建选项" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="若标准答案为AB,C在答案输入框填
入ABC即可" type="text">
</li>
<div class="cl"></div>
</ul>
</div>
<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_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a> </div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,28 @@
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<input maxlength="250" class="questionTitle" name="poll_questions_title" id="poll_questions_title" placeholder="请输入填空题题目" type="text">
</div>
<div class="ur_editor_content">
<ul>
<li class="ur_item">
<label>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input name="question_answer[0]" placeholder="关键词一" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input name="question_answer[1]" placeholder="关键词二(选填)" type="text">
<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>&nbsp;&nbsp;&nbsp;</label>
<input name="question_answer[2]" placeholder="关键词三(选填)" type="text">
<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>
</ul>
</div>
<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_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a> </div>
<div class="cl"></div>
</div>

View File

@ -10,37 +10,64 @@
<span class="f12 c_red">您已提交</span>
<% end %>
</span>
<%if @is_teacher || @exercise.exercise_status == 3%>
<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%#= student_work_index_path(:homework => @homework.id)%>',event);"/>
<%#if @is_teacher || @exercise.exercise_status == 3%>
<!--<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%#= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%#= student_work_index_path(:homework => @homework.id)%>',event);"/>
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%#= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
</div>
</div>-->
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<% end%>
<%# end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示测验信息 ]</a> </span>
</div>
<div class="cl"></div>
<div class="fl">
<%= render :partial => "evaluation_un_title"%>
<%= render :partial => "student_table"%>
</div>
<div class="cl"></div>
<% @stundet_works.each do |student_work|%>
<% if @is_evaluation%>
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%>
<% else%>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
<% end%>
<div class="cl"></div>
<div id="about_hwork_<%= student_work.id%>">
<% if student_work.user == User.current && !@is_evaluation %>
<% if @homework.homework_type == 2%>
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% else %>
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% end %>
<% end %>
<% @exercise_users_list.each do |exercise|%>
<script type="text/javascript">
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide();
});
</script>
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
<li class="hworkList340 width530">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li>
<div onclick="" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名">
<%= exercise.user.show_name%>
</li>
<li class="hworkStID mr10 mt16" title="学号">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li>
<li class="hworkStID mt16" title="班级">
--
</li>
</ul>
</li>
</div>
</ul>
</li>
<li class="hworkList130 c_grey student_work_<%= exercise.id%>" onclick="" style="cursor: pointer;">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% end %>
</li>
<li class="hworkList50 <%= score_color exercise.score%> student_final_scor_info">
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
</li>
<li class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
</ul>
<div class="cl"></div>
<% end%>

View File

@ -0,0 +1,22 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 width530">
<span class="c_dark f14 fb fl mr55">&nbsp;&nbsp;</span>
<span class="c_dark f14 fb fl mr60">姓名</span>
<span class="c_dark f14 fb fl mr60">学号</span>
<span class="c_dark f14 fb fl">班级</span>
</li>
<li class="hworkList130 hworkH30">
<%= link_to "时间",'',:class => "c_dark f14 fb fl ml50" ,:remote => true%>
<%# if @show_all && @order == "created_at"%>
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<%# end%>
</li>
<li class="hworkList50 hworkH30">
<%= link_to "成绩",'',:class => "c_dark f14 fb fl ml10",:remote => true%>
<%# if @show_all && @order == "score"%>
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
<%# end%>
</li>
</ul>

View File

@ -0,0 +1 @@
<%= render :partial => 'exercise_form'%>

View File

@ -0,0 +1 @@
<%= render :partial => 'exercise_form'%>

View File

@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
.width180{width: 180px;}
.width525{width: 525px;}
.width285{width: 285px;}
.width530{width: 530px;}
.mr95{margin-right: 95px;}
.mr140 {margin-right: 140px;}
.ml100{margin-left: 100px;}
@ -1141,3 +1142,17 @@ input.sendSourceText {
width: 50px;
height: 25px;
}
/*20151117在线测验byTim*/
.testContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.testTitle{ width:678px; height:40px; padding:0 10px; text-align:center; font-size:16px; font-weight:bold; background:#fff;border-style:solid; border:1px solid #CBCBCB;}
.testDes{ width:678px; height:120px; padding:10px; margin-bottom:10px; background:#fff; border-style:solid; border:1px solid #CBCBCB; resize:none;}
.btn_submit{ width:56px; height:24px; padding-top:4px;background:#269ac9; color:#fff; text-align:center; display:block; float:left; margin-right:10px;}
a:hover.btn_submit{background:#297fb8;}
.btn_cancel{width:54px; height:22px; padding-top:4px;background:#fff; color:#999; border:1px solid #999; text-align:center; display:block; float:left; }
a:hover.btn_cancel{ color:#666;}
.testQuestion{ width:708px; height: auto; border:1px solid #cbcbcb; padding:10px 0 0 10px; margin-bottom:10px;}
.mr118 {margin-right:118px !important;}
.questionContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.questionTitle{ width:644px; height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
.examTime {width:40px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }