|
|
|
@ -1,16 +1,20 @@
|
|
|
|
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
|
|
|
|
<%= stylesheet_link_tag "project","public"%>
|
|
|
|
|
<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| %>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<%= f.text_area :subject %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<%= f.kindeditor :description,:width=>'87%',:editor_id=>'system_message_editor' %>
|
|
|
|
|
<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>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<div>
|
|
|
|
|
<p id="content_notice_span" class="ml55"></p>
|
|
|
|
|
</div>
|
|
|
|
@ -22,13 +26,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
function system_message_length() {
|
|
|
|
|
var obj = system_message_editor.html();
|
|
|
|
|
if (obj.length == 0) {
|
|
|
|
|
$("#content_notice_span").text("内容不能为空");
|
|
|
|
|
$("#content_notice_span").css('color', '#ff0000');
|
|
|
|
|
$("#content_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (obj.length > 10000) {
|
|
|
|
|
if (obj.length > 10000) {
|
|
|
|
|
$("#content_notice_span").text("内容过长,超过10000个字符");
|
|
|
|
|
$("#content_notice_span").css('color', '#ff0000');
|
|
|
|
|
$("#content_notice_span").focus();
|
|
|
|
@ -40,9 +38,27 @@
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function regexTitle(obj){
|
|
|
|
|
var title = obj.val();
|
|
|
|
|
alert(title);
|
|
|
|
|
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()) {
|
|
|
|
|
if (system_message_length() && regexTitle($("#system_message_subject"))) {
|
|
|
|
|
$("#system_messages-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|