2015-03-24 17:12:51 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function regexTitle()
|
|
|
|
|
{
|
|
|
|
|
var name = $("#news_title").val();
|
|
|
|
|
if(name.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("标题不能为空");
|
|
|
|
|
$("#title_notice_span").css('color','#ff0000');
|
|
|
|
|
$("#title_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length <= 60)
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("填写正确");
|
|
|
|
|
$("#title_notice_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("标题超过60个字符");
|
|
|
|
|
$("#title_notice_span").css('color','#ff0000');
|
|
|
|
|
$("#title_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regexDescription()
|
|
|
|
|
{
|
|
|
|
|
var name = $("#news_description").val();
|
|
|
|
|
if(name.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#description_notice_span").text("描述不能为空");
|
|
|
|
|
$("#description_notice_span").css('color','#ff0000');
|
|
|
|
|
$("#description_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#description_notice_span").text("填写正确");
|
|
|
|
|
$("#description_notice_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submitNews()
|
|
|
|
|
{
|
|
|
|
|
if(regexTitle() && regexDescription())
|
|
|
|
|
{
|
|
|
|
|
$("#news-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submitFocus(obj)
|
|
|
|
|
{
|
|
|
|
|
$(obj).focus();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<li class="ml45">
|
2015-03-24 09:51:42 +08:00
|
|
|
|
<label><span class="c_red">*</span> <%= l(:field_title) %> :</label>
|
|
|
|
|
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内">
|
2015-03-24 17:12:51 +08:00
|
|
|
|
<span id="title_notice_span"></span>
|
2015-03-24 09:51:42 +08:00
|
|
|
|
</li>
|
|
|
|
|
<li class="ml45">
|
|
|
|
|
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
|
|
|
|
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" ></textarea>
|
2015-03-24 17:12:51 +08:00
|
|
|
|
<span id="description_notice_span"></span>
|
2015-03-24 09:51:42 +08:00
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
2015-03-24 17:12:51 +08:00
|
|
|
|
<li class="ml45">
|
|
|
|
|
<label> <%= l(:label_attachment_plural) %> :</label>
|
2014-12-30 14:52:44 +08:00
|
|
|
|
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
|
2015-03-24 17:12:51 +08:00
|
|
|
|
</li>
|
|
|
|
|
<li class=" ml90" >
|
|
|
|
|
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
|
|
|
|
|
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<!-- <#%= wikitoolbar_for 'news_description'%>-->
|