|
|
|
@ -1,3 +1,55 @@
|
|
|
|
|
<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>
|
|
|
|
|
<div class="contextual">
|
|
|
|
|
<%= watcher_link(@news, User.current) %>
|
|
|
|
|
<%= link_to(l(:button_edit),
|
|
|
|
@ -15,9 +67,10 @@
|
|
|
|
|
<%= labelled_form_for :news, @news, :url => news_path(@news),
|
|
|
|
|
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
|
|
|
|
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
|
|
|
|
<%= submit_tag l(:button_save) %>
|
|
|
|
|
<%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => ''} %> |
|
|
|
|
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %>
|
|
|
|
|
<%#= submit_tag l(:button_save) %>
|
|
|
|
|
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:class => 'whiteButton m3p10' %>
|
|
|
|
|
<%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> |
|
|
|
|
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div id="preview" class="wiki"></div>
|
|
|
|
|
</div>
|
|
|
|
|