|
|
|
@ -1,3 +1,62 @@
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function regexTitle()
|
|
|
|
|
{
|
|
|
|
|
var title = $.trim($("#contestnotification_title").val());
|
|
|
|
|
if(title.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#title_span").text("<%= l(:label_no_contest_news_title) %>");
|
|
|
|
|
$("#title_span").css('color','#ff0000');
|
|
|
|
|
$("#title_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(title.length <= 254)
|
|
|
|
|
{
|
|
|
|
|
$("#title_span").text("<%= l(:label_field_correct) %>");
|
|
|
|
|
$("#title_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#title_span").text("<%= l(:label_contest_news_title_condition) %>");
|
|
|
|
|
$("#title_span").css('color','#ff0000');
|
|
|
|
|
$("#title_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//验证描述:不能为空,不能多余5000个字符
|
|
|
|
|
function regexDescription()
|
|
|
|
|
{
|
|
|
|
|
var description = $.trim($("#contestnotification_description").val());
|
|
|
|
|
if(description.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#description_span").text("<%= l(:label_no_contest_news_description) %>");
|
|
|
|
|
$("#description_span").css('color','#ff0000');
|
|
|
|
|
$("#description_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(description.length <= 5000)
|
|
|
|
|
{
|
|
|
|
|
$("#description_span").text("<%= l(:label_field_correct) %>");
|
|
|
|
|
$("#description_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#description_span").text("<%= l(:label_contest_news_condition) %>");
|
|
|
|
|
$("#description_span").css('color','#ff0000');
|
|
|
|
|
$("#description_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function submitContestNews()
|
|
|
|
|
{
|
|
|
|
|
if(regexTitle() && regexDescription())
|
|
|
|
|
{
|
|
|
|
|
$("#contestnotifications-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
|
|
|
|
<%= l(:label_notification) %>
|
|
|
|
|
</span>
|
|
|
|
@ -12,10 +71,9 @@
|
|
|
|
|
<%= labelled_form_for @contestnotification, :url => contest_contestnotifications_path(@contest),
|
|
|
|
|
:html => {:id => 'contestnotifications-form', :multipart => true} do |f| %>
|
|
|
|
|
<%= render :partial => 'contestnotifications/form', :locals => {:f => f} %>
|
|
|
|
|
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %>
|
|
|
|
|
<%#= preview_link preview_contestnotifications_path(:contest_id => @contest), 'contestnotifications-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
|
|
|
|
<input type="button" onclick="submitContestNews();" class="enterprise" value="<%= l(:button_create)%>"/>
|
|
|
|
|
|
|
|
|
|
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-contestnotifications").hide(); return false;', :class => 'whiteButton m3p10' %>
|
|
|
|
|
<input type="button" onclick="$('#add-contestnotifications').hide(); return false;" class="enterprise" value="<%= l(:button_cancel)%>"/>
|
|
|
|
|
<% end if @contest %>
|
|
|
|
|
<div id="preview" class="wiki"></div>
|
|
|
|
|
</div>
|
|
|
|
|