系统消息

This commit is contained in:
ouyangxuhua 2015-09-11 10:30:01 +08:00
parent 0bb8b175e6
commit 36e9c20e59
2 changed files with 18 additions and 7 deletions

View File

@ -1,9 +1,10 @@
# encoding: utf-8
<%= 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_message', :multipart => true}) do |f| %>
<%= form_for(@admin_messages, :html => {:id =>'system_message_form', :multipart => true}) do |f| %>
<div class="field">
<%= f.kindeditor :content, :edit_id => 'system_message',
:width => '87%',
@ -20,23 +21,33 @@
<% end %>
</div>
<script>
function system_message_length(obj)
function system_message_length()
{
var obj = $("#system_message").value;
if (obj.length == 0) {
$("#content_notice_span").text("内容不能为空");
$("#content_notice_span").text("内容不能为空");
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
return false;
}
else if (obj.length > 255) {
$("#content_notice_span").text("内容过长超过255个字符");
$("#content_notice_span").text("内容过长超过255个字符");
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
return false;
}
else {
$("#content_notice_span").text("填写正确");
$("#content_notice_span").text("填写正确");
$("#content_notice_span").css('color', '#008000');
$("#system_message").submit();
return true;
}
}
function submit_message()
{
if (system_message_length())
{
$("#system_message_form").submit();
}
}
</script>

View File

@ -60,7 +60,7 @@
%>
</li>
<div style="display:none;" class="message_title">
<%= ma.content.html_safe%>
<%= usm.content.html_safe%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
</ul>