parent
dd8e8e38ac
commit
ab88156d2f
|
@ -30,14 +30,22 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
if @homework_type == "1"
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
elsif @homework_type == "2"
|
||||
#编程作业相关属性
|
||||
@homework_detail_programing = HomeworkDetailPrograming.new
|
||||
@homework.homework_detail_programing = @homework_detail_programing
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
@ -58,15 +66,31 @@ class HomeworkCommonController < ApplicationController
|
|||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
#匿评作业相关属性
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_detail_manual.comment_status = 1
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework.homework_detail_manual = homework_detail_manual
|
||||
if homework.homework_type == 2
|
||||
homework_detail_programing = HomeworkDetailPrograming.new
|
||||
homework_detail_programing.language = "C++"
|
||||
homework_detail_programing.standard_code = params[:standard_code]
|
||||
|
||||
if params[:input] && params[:output]
|
||||
params[:input].each do |k,v|
|
||||
if params[:output][k]
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework.homework_detail_programing = homework_detail_programing
|
||||
else
|
||||
#匿评作业相关属性
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_detail_manual.comment_status = 1
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework.homework_detail_manual = homework_detail_manual
|
||||
end
|
||||
|
||||
if homework.save
|
||||
respond_to do |format|
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<ul class="hwork_new_basic">
|
||||
<li >
|
||||
<label class="label02 mb10">
|
||||
<label class="label02 mb20">
|
||||
<span class="c_red">*</span>
|
||||
<%= l(:field_name)%>:
|
||||
</label>
|
||||
|
@ -12,10 +12,10 @@
|
|||
<label class="label02 "> <%= l(:field_quote)%>: </label>
|
||||
<div style="width: 83%;float: left;">
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor_1',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor_1' %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -62,28 +62,29 @@
|
|||
</li>
|
||||
<li >
|
||||
<label class="label02"> 标准代码: </label>
|
||||
<textarea name="" class=" w459 h150 mb10 fl" ></textarea>
|
||||
<textarea name="standard_code" class=" w547 h150 mb10 fl"><%= homework.homework_detail_programing.standard_code%></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w196 mb10" />
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w196 mb10" />
|
||||
</li>
|
||||
<li><a class="icon_add ml10 " href="javascript:void(0);" title="添加测试"></a> <span class="green_btn fl ml5">OK !</span></li>
|
||||
<div class="cl"></div>
|
||||
<li >
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w196 mb10" />
|
||||
</li>
|
||||
<li >
|
||||
<label class="fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w196 mb10" />
|
||||
</li>
|
||||
<li><a class="icon_add ml10 " href="javascript:void(0);" title="添加测试"></a> <a href="javascript:void(0);" class="green_btn fl ml5 ">测试</a></li>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if edit_mode %>
|
||||
|
||||
<% else %>
|
||||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="input[0]" />
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="output[0]" />
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
|
||||
<span class="green_btn fl ml5 mt1">测试</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,5 +1,3 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
|
@ -20,7 +19,7 @@
|
|||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%>
|
||||
<%= hidden_field_tag "homework_common[homework_type]","2"%>
|
||||
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
|
|
|
@ -415,6 +415,7 @@ function regex_homework_name()
|
|||
//验证匿评数量
|
||||
function regex_evaluation_num()
|
||||
{
|
||||
if($("#evaluation_num").length == 0){ return true;}
|
||||
var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if(evaluation_num=="")
|
||||
|
@ -502,6 +503,25 @@ function submit_homework(id)
|
|||
}
|
||||
}
|
||||
|
||||
//增加测试结果
|
||||
function add_programing_test(obj) {
|
||||
var now = new Date().getTime();
|
||||
obj.after("<div><li><label class='label02'> 测试输入: </label><input type='text' class='fl h26 w186 mb10' name='input[" + now +"]'' />" +
|
||||
"</li><li ><label class='fl f14 ml10'> 输出: </label><input type='text' class='fl h26 w186 mb10' name='output[" + now +"]' />" +
|
||||
"</li><li><a class='icon_add ml10' href='javascript:void(0);' title='添加测试' onclick='add_programing_test($(this).parent().parent())'></a>" +
|
||||
"<a class='icon_remove' href='javascript:void(0);' title='删除测试' onclick='remove_programing_test($(this).parent().parent())'></a>" +
|
||||
"<span class='green_btn fl ml5 mt1'>测试</span></li><div class='cl'></div></div>");
|
||||
}
|
||||
//删除测试结果
|
||||
function remove_programing_test(obj) {
|
||||
if(obj.siblings("div").length == 0){
|
||||
alert("至少需要一组测试");
|
||||
}
|
||||
else{
|
||||
obj.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function show_window (id1,id2,top,left) {
|
||||
$('#'+ id1).css('top',top);
|
||||
$('#'+ id1).css('left',left);
|
||||
|
|
|
@ -551,19 +551,7 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
|
|||
a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; }
|
||||
a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;}
|
||||
|
||||
/* 20150423作业评分*/
|
||||
.ml14{ margin-left:14px;}
|
||||
.w548{ width:552px;}
|
||||
.w547{ width:544px;}
|
||||
.w196{ width:182px;}
|
||||
.w459{ width:459px;}
|
||||
.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;}
|
||||
.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;}
|
||||
.hwork_new_left{ width:220px; float:left; }
|
||||
.hwork_new_right{ width:350px; float:left; margin-left:40px;}
|
||||
.w305{ width:305px;}
|
||||
.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||
|
||||
|
||||
/* 20150505讨论区*/
|
||||
.w664{ width:664px;}
|
||||
|
@ -599,10 +587,12 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
|
|||
/*.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}*/
|
||||
#about_newtalk{ display:none;}
|
||||
|
||||
/* 20150423作业评分*/
|
||||
.ml14{ margin-left:14px;}
|
||||
.w548{ width:552px;}
|
||||
.w547{ width:544px;}
|
||||
.w196{ width:196px;}
|
||||
.w186{ width:186px;}
|
||||
.w459{ width:459px;}
|
||||
.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;}
|
||||
.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;}
|
||||
|
@ -611,6 +601,8 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
|
|||
.w305{ width:305px;}
|
||||
.icon_add{background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||
.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
|
||||
a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
|
||||
|
||||
/* 20150506上传头像*/
|
||||
.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;}
|
||||
|
|
|
@ -77,6 +77,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.mr50{margin-right: 50px;}
|
||||
.mr55{margin-right: 55px;}
|
||||
.mr70{margin-right: 70px;}
|
||||
.mt1{margin-top: 1px;}
|
||||
.mt3{ margin-top:3px;}
|
||||
.mt5{ margin-top:5px;}
|
||||
.mt8{ margin-top:8px;}
|
||||
|
|
Loading…
Reference in New Issue