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(); } }