From 296d4a678c11c652e9ee76283640d20d451fc69c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 20 May 2015 15:43:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BD=9C=E4=B8=9Ajs=E9=AA=8C?=
=?UTF-8?q?=E8=AF=81=E4=BB=A5=E5=8F=8A=E9=A1=B5=E9=9D=A2=E6=93=8D=E4=BD=9C?=
=?UTF-8?q?js=E6=95=88=E6=9E=9C=E6=B7=BB=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../_homework_common_form.html.erb | 16 ++---
app/views/homework_common/new.html.erb | 4 +-
public/javascripts/course.js | 64 +++++++++++--------
3 files changed, 46 insertions(+), 38 deletions(-)
diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_common_form.html.erb
index 7b11ce712..a2bcf9ad9 100644
--- a/app/views/homework_common/_homework_common_form.html.erb
+++ b/app/views/homework_common/_homework_common_form.html.erb
@@ -1,11 +1,11 @@
- -
-
diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb
index ad9d17d24..6b21eabc3 100644
--- a/app/views/homework_common/new.html.erb
+++ b/app/views/homework_common/new.html.erb
@@ -9,8 +9,8 @@
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
-
提交
-
取消
+
提交
+ <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
\ No newline at end of file
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 3a8d82776..e01407331 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -398,60 +398,68 @@ function regex_homework_name()
//验证匿评数量
function regex_evaluation_num()
{
- var evaluation_num = $.trim($("#bid_evaluation_num").val());
+ var evaluation_num = $.trim($("#evaluation_num").val());
var regex = /^\d+$/;
- if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
+ if(evaluation_num=="")
{
- if(evaluation_num=="")
+ $("#evaluation_num_notice").html("匿评分配数量不能为空");
+ $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
+ return false;
+ }
+ else if(regex.test(evaluation_num))
+ {
+ if(evaluation_num > 0)
{
- $("#bid_evaluation_num_span").text("匿评分配数量不能为空");
- return false;
- }
- else if(regex.test(evaluation_num))
- {
- if(evaluation_num > 0)
- {
- $("#bid_evaluation_num_span").text("");
- return true;
- }
- else
- {
- $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
- return false;
- }
+ $("#evaluation_num_notice").html("每个学生将收到 "+ parseInt(evaluation_num) + " 份待匿评作品");
+ $("#evaluation_num_notice").removeClass("c_red");
+ return true;
}
else
{
- $("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
+ $("#evaluation_num_notice").html("匿评分配数量必须为大于0");
+ $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
return false;
}
}
else
{
- return true;
+ $("#evaluation_num_notice").html("匿评分配数量只能为数字");
+ $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
+ return false;
}
}
//点击是否开启匿评单选框效果
$(function(){
- $("#bid_open_anonymous_evaluation").click(function(){
- if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
+ $("#homework_common_homework_type").click(function(){
+ if($("#homework_common_homework_type").attr("checked") == "checked")
{
- $("#bid_evaluation_num_li").slideDown();
+ $("#evaluation_setting").slideDown();
+ $("#ta_proportion").removeAttr("disabled");
}
else
{
- $("#bid_evaluation_num_li").slideUp();
+ $("#evaluation_setting").slideUp();
+ $("#ta_proportion").attr("disabled","disabled");
}
});
+
+ $("#absence_penalty").change(function(){
+ $("#absence_penalty_notice").html(" "+ $("#absence_penalty").val() +" ");
+ });
+
+ $("#ta_proportion").change(function(){
+ var ta_proportion = $("#ta_proportion").val();
+ $("#student_proportion").val(parseInt((1-ta_proportion)*100) + "%");
+ });
});
-//老师提交新建作业
-function submit_new_bid(id)
+//老师提交 新建/修改 作业
+function submit_homework(id)
{
- if(regex_bid_name()&®ex_evaluation_num())
+ if(regex_homework_name()&®ex_evaluation_num())
{
- bid_description_editor.sync();
+ homework_description_editor.sync();
$("#"+id).submit();
}
}