作品名称改为作品描述

对齐作品名称和作品描述
增加作品描述不能为空的判断
This commit is contained in:
sw 2014-11-22 11:19:58 +08:00
parent a95a68caec
commit dacad26010
2 changed files with 26 additions and 8 deletions

View File

@ -2,11 +2,11 @@
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html">
function regexName()
{
var name = $("#homework_attach_name").val();
var name = $.trim($("#homework_attach_name").val());
if(name=="")
{
$("#homework_attach_name_span").text("名称不能为空");
$("#homework_attach_name_span").text("作品名称不能为空");
$("#homework_attach_name_span").css('color','#ff0000');
return false;
}
@ -17,8 +17,25 @@
return true;
}
}
function regexDescription()
{
var name = $.trim($("#homework_attach_description").val());
function submit_homework_form(){if(regexName()){$('#new_homework_attach').submit();}}
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()&&regexDescription()){$('#new_homework_attach').submit();}}
</script>
<div class="container">
<div class="Newwork">
@ -55,13 +72,14 @@
<span id="homework_attach_name_span"></span>
</p>
<p>
<label style="float:left;padding-left:10px;">
<label style="float:left;padding-right: 3px;">
<span class="c_red">
*
</span>
&nbsp;&nbsp;作描述&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;作描述&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字"%>
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字", :onblur => "regexDescription();"%>
<span id="homework_attach_description_span" style="padding-left: 100px;"></span>
</p>
<div class="cl"></div>
<p>

View File

@ -128,7 +128,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.w430{ width:430px;}
.w350{ width:350px;}
.w620{ width:580px; height:160px; border:1px solid #CCC;}
.w620{ width:580px; height:160px; border:1px solid #CCC !important; padding-left: 3px !important;}
.bo{height:26px; border:1px solid #CCC !important; padding: 0 !important;}
a.tijiao{ height:28px !important; display:block !important; width:80px !important; color:#fff !important; background:#15bccf !important; text-align:center !important; padding-top:4px !important; float:left !important; margin-right:10px !important;}
a:hover.tijiao{ background:#0f99a9 !important;}