socialforge/app/views/admin/messages.html.erb

54 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-09-11 10:30:01 +08:00
# encoding: utf-8
2015-09-09 17:42:38 +08:00
<%= 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;">
2015-09-11 10:30:01 +08:00
<%= form_for(@admin_messages, :html => {:id =>'system_message_form', :multipart => true}) do |f| %>
<div class="field">
2015-09-09 17:42:38 +08:00
<%= f.kindeditor :content, :edit_id => 'system_message',
:width => '87%',
:resizeType => '0',
:no_label => true
%>
</div>
2015-09-11 09:48:16 +08:00
<div>
<p id="content_notice_span" class="ml55"></p>
</div>
<div class="actions">
2015-09-09 17:42:38 +08:00
<%= f.submit l(:label_submit),:class => "small", :onclick => "system_message.sync;" %>
</div>
<% end %>
</div>
2015-09-11 09:48:16 +08:00
<script>
2015-09-11 10:30:01 +08:00
function system_message_length()
2015-09-11 09:48:16 +08:00
{
2015-09-11 10:30:01 +08:00
var obj = $("#system_message").value;
2015-09-11 09:48:16 +08:00
if (obj.length == 0) {
2015-09-11 10:30:01 +08:00
$("#content_notice_span").text("内容不能为空");
2015-09-11 09:48:16 +08:00
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
2015-09-11 10:30:01 +08:00
return false;
2015-09-11 09:48:16 +08:00
}
else if (obj.length > 255) {
2015-09-11 10:30:01 +08:00
$("#content_notice_span").text("内容过长超过255个字符");
2015-09-11 09:48:16 +08:00
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
2015-09-11 10:30:01 +08:00
return false;
2015-09-11 09:48:16 +08:00
}
else {
2015-09-11 10:30:01 +08:00
$("#content_notice_span").text("填写正确");
2015-09-11 09:48:16 +08:00
$("#content_notice_span").css('color', '#008000');
2015-09-11 10:30:01 +08:00
return true;
2015-09-11 09:48:16 +08:00
}
}
2015-09-11 10:30:01 +08:00
function submit_message()
{
if (system_message_length())
{
$("#system_message_form").submit();
}
}
2015-09-11 09:48:16 +08:00
</script>