84 lines
3.3 KiB
Plaintext
84 lines
3.3 KiB
Plaintext
<script type="text/javascript">
|
||
function regexSubject()
|
||
{
|
||
var content = $.trim($("#message_subject").val());
|
||
if(content.length ==0)
|
||
{
|
||
$("#subject_span").text("<%= l(:label_subject_empty) %>");
|
||
$("#subject_span").css('color','#ff0000');
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
$("#subject_span").text("<%= l(:label_field_correct) %>");
|
||
$("#subject_span").css('color','#008000');
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function regexContent()
|
||
{
|
||
var content = $.trim($("#message_content").val());
|
||
if(content.length ==0)
|
||
{
|
||
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
|
||
$("#message_content_span").css('color','#ff0000');
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
$("#message_content_span").text("<%= l(:label_field_correct) %>");
|
||
$("#message_content_span").css('color','#008000');
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function submitCoursesBoard()
|
||
{
|
||
if(regexSubject()&®exContent()){$("#message-form").submit();}
|
||
}
|
||
</script>
|
||
<%= error_messages_for 'message' %>
|
||
<% replying ||= false %>
|
||
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
|
||
|
||
<li>
|
||
<label><span class="c_red">*</span> <%= l(:field_subject) %> :</label>
|
||
<% if replying %>
|
||
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
|
||
<% else %>
|
||
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
|
||
<% end %>
|
||
<span id="subject_span"></span>
|
||
</li>
|
||
<li class="ml60 mb5">
|
||
<% unless replying %>
|
||
<% if @message.safe_attribute? 'sticky' %>
|
||
<%= f.check_box :sticky %>
|
||
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||
<% end %>
|
||
<% if @message.safe_attribute? 'locked' %>
|
||
<%= f.check_box :locked %>
|
||
<%= label_tag 'message_locked', l(:label_board_locked) %>
|
||
<% end %>
|
||
<% end %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<li>
|
||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
|
||
<span id="message_content_span"></span>
|
||
</li>
|
||
<div class="cl"></div>
|
||
<li>
|
||
<label> <%= l(:label_attachment_plural) %> :</label>
|
||
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
|
||
</li>
|
||
<li >
|
||
<a href="#" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
|
||
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'blue_btn grey_btn fl c_white'} )%>
|
||
<div class="cl"></div>
|
||
</li>
|