diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index cf182716e..b32eb8c8d 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -1,42 +1,4 @@ <%= stylesheet_link_tag 'css', :media => 'all' %> -
@@ -69,7 +31,7 @@   作品名称    : - <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %> + <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexHomeworkCommonName();" %>

@@ -79,7 +41,7 @@   作品描述    :  - <%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%> + <%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexHomeworkCommonDescription();"%>

diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 806768954..66641707a 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -89,11 +89,11 @@
  • - +
  • - +
  • @@ -107,11 +107,11 @@
  • - +
  • - +
  • diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 7c165a4c6..b2736993b 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -506,14 +506,51 @@ function submit_homework(id) } } +function regexHomeworkCommonName() +{ + var name = $.trim($("#homework_attach_name").val()); + + if(name=="") + { + $("#homework_attach_name_span").text("作品名称不能为空"); + $("#homework_attach_name_span").css('color','#ff0000'); + return false; + } + else + { + $("#homework_attach_name_span").text("填写正确"); + $("#homework_attach_name_span").css('color','#008000'); + return true; + } +} +function regexHomeworkCommonDescription() +{ + var name = $.trim($("#homework_attach_description").val()); + + if(name=="") + { + $("#homework_attach_description_span").text("作品描述不能为空"); + $("#homework_attach_description_span").css('color','#ff0000'); + return false; + } + else + { + $("#homework_attach_description_span").text("填写正确"); + $("#homework_attach_description_span").css('color','#008000'); + return true; + } +} + +function submit_homework_form(){if(regexHomeworkCommonName()&®exHomeworkCommonDescription()){$('#new_homework_attach').submit();}} + //增加测试结果 function add_programing_test(obj) { var now = new Date().getTime(); - obj.after("
  • " + - "
  • " + + obj.after("
  • " + + "
  • " + "
  • " + "" + - "测试
  • "); + "
    "); } //删除测试结果 function remove_programing_test(obj) { diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index abeec52d3..5a7bb001a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -609,6 +609,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .w547{ width:544px;} .w196{ width:196px;} .w186{ width:186px;} +.w200{width: 200px;} .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;}