65 lines
2.5 KiB
Plaintext
65 lines
2.5 KiB
Plaintext
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||
<h3 style="float: left">
|
||
<%=l(:label_system_message)%>
|
||
</h3><br/>
|
||
<div style="padding-top: 20px; padding-left: 5px;">
|
||
<%= form_for(@admin_messages, :html => {:id =>'system_messages-form'}) do |f| %>
|
||
<li>
|
||
<label><span class="">*</span> <%= l(:field_title) %> :</label>
|
||
<input type="text" name="system_message[subject]" class="hwork_input_news" id="system_message_subject" width="576px" onblur="regexTitle($(this));" maxlength="255" placeholder="255个字符以内" value="">
|
||
<p id="title_notice_span" class="ml55"></p>
|
||
</li>
|
||
<li>
|
||
<label class="fl" > <span class="c_red"></span> <%= l(:field_description) %> :</label>
|
||
<%= f.kindeditor :description,:width=>'87.5%',:editor_id=>'system_message_editor' %>
|
||
<p id="content_notice_span" class="ml55"></p>
|
||
</li>
|
||
<div>
|
||
<p id="content_notice_span" class="ml55"></p>
|
||
</div>
|
||
<div class="actions">
|
||
<%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "system_message_editor.sync();submit_message();" %>
|
||
</div>
|
||
<% end %>
|
||
</div>
|
||
<script>
|
||
function system_message_length() {
|
||
var obj = system_message_editor.html();
|
||
if (obj.length > 10000) {
|
||
$("#content_notice_span").text("内容过长,超过10000个字符");
|
||
$("#content_notice_span").css('color', '#ff0000');
|
||
$("#content_notice_span").focus();
|
||
return false;
|
||
}
|
||
else {
|
||
$("#content_notice_span").text("填写正确");
|
||
$("#content_notice_span").css('color', '#008000');
|
||
return true;
|
||
}
|
||
}
|
||
function regexTitle(obj){
|
||
var title = obj.val();
|
||
if(title.length == 0)
|
||
{
|
||
$("#title_notice_span").text("标题不能为空").css("color", "#ff0000").focus();
|
||
return false;
|
||
}
|
||
else if(title.length > 255)
|
||
{
|
||
$("#title_notice_span").text("标题长度过长,不能超过255个字符").css("color", "#ff0000").focus();
|
||
return false;
|
||
}
|
||
else{
|
||
$("#title_notice_span").text("填写正确").css("color", "#008000");
|
||
return true;
|
||
}
|
||
}
|
||
function submit_message() {
|
||
|
||
if (system_message_length() && regexTitle($("#system_message_subject"))) {
|
||
$("#system_messages-form").submit();
|
||
}
|
||
}
|
||
</script>
|
||
|