编程作业新增测试取消测试按钮
This commit is contained in:
parent
c65d318fbb
commit
8c82f6c6a7
|
@ -1,42 +1,4 @@
|
|||
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
||||
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html">
|
||||
function regexName()
|
||||
{
|
||||
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 regexDescription()
|
||||
{
|
||||
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(regexName()&®exDescription()){$('#new_homework_attach').submit();}}
|
||||
</script>
|
||||
<div class="container" id="content">
|
||||
<div class="Newwork">
|
||||
<div id="tb_" class="tb_">
|
||||
|
@ -69,7 +31,7 @@
|
|||
</span>
|
||||
作品名称 :
|
||||
</label>
|
||||
<%= 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();" %>
|
||||
<span id="homework_attach_name_span"></span>
|
||||
</p>
|
||||
<p style="float:left;">
|
||||
|
@ -79,7 +41,7 @@
|
|||
</span>
|
||||
作品描述 :
|
||||
</label>
|
||||
<%= 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();"%>
|
||||
<p id="homework_attach_description_span" style="padding-left: 100px;"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -89,11 +89,11 @@
|
|||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
|
||||
<input type="text" class="fl h26 w200 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
|
||||
<input type="text" class="fl h26 w200 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
|
@ -107,11 +107,11 @@
|
|||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="input[0]" />
|
||||
<input type="text" class="fl h26 w200 mb10" name="input[0]" />
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="output[0]" />
|
||||
<input type="text" class="fl h26 w200 mb10" name="output[0]" />
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
|
|
|
@ -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("<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 +"]' />" +
|
||||
obj.after("<div><li><label class='label02'> 测试输入: </label><input type='text' class='fl h26 w200 mb10' name='input[" + now +"]'' />" +
|
||||
"</li><li ><label class='fl f14 ml10'> 输出: </label><input type='text' class='fl h26 w200 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>");
|
||||
"</li><div class='cl'></div></div>");
|
||||
}
|
||||
//删除测试结果
|
||||
function remove_programing_test(obj) {
|
||||
|
|
|
@ -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;}
|
||||
|
|
Loading…
Reference in New Issue