|
|
|
@ -3,6 +3,59 @@
|
|
|
|
|
label_tips = l(:label_course_news)
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
<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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
|
|
|
|
<%= label_tips %>
|
|
|
|
|
</span>
|
|
|
|
@ -16,7 +69,8 @@
|
|
|
|
|
<%= labelled_form_for @news, :url => course_news_index_path(@course),
|
|
|
|
|
:html => {:id => 'news-form', :multipart => true} do |f| %>
|
|
|
|
|
<%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %>
|
|
|
|
|
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> |
|
|
|
|
|
<%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit -->
|
|
|
|
|
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :class => 'whiteButton m3p10' %>|
|
|
|
|
|
<%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
|
|
|
|
|
|
|
|
|
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %>
|
|
|
|
|