parent
64bce0261d
commit
8c0f9d24f8
|
@ -44,6 +44,13 @@ class SystemMessagesController < ApplicationController
|
|||
if @system_messages.save
|
||||
format.html {redirect_to user_message_path(User.current, :type => "system_message")}
|
||||
flash[:notice] = l(:notice_successful_message)
|
||||
else
|
||||
if params[:system_message][:content].empty?
|
||||
flash[:error] = l(:label_content_blank_fail)
|
||||
else
|
||||
flash[:error] = l(:label_admin_message_fail)
|
||||
end
|
||||
format.html {redirect_to admin_messages_path}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class SystemMessage < ActiveRecord::Base
|
||||
attr_accessible :content, :id, :user_id
|
||||
belongs_to :user
|
||||
|
||||
validates :content, presence: true
|
||||
validates_length_of :content, maximum: 255
|
||||
end
|
||||
|
|
|
@ -4,50 +4,16 @@
|
|||
<%=l(:label_system_message)%>
|
||||
</h3><br/>
|
||||
<div style="padding-top: 20px; padding-left: 5px;">
|
||||
<%= form_for(@admin_messages, :html => {:id =>'system_message_form', :multipart => true}) do |f| %>
|
||||
<%= form_for(@admin_messages) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.kindeditor :content, :edit_id => 'system_message',
|
||||
:width => '87%',
|
||||
:resizeType => '0',
|
||||
:no_label => true
|
||||
%>
|
||||
<%= f.kindeditor :content, :edit_id => 'system_message', :width => '87%', :resizeType => '0', :no_label => true %>
|
||||
</div>
|
||||
<div>
|
||||
<p id="content_notice_span" class="ml55"></p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit l(:label_submit),:class => "small", :onclick => "system_message.sync;" %>
|
||||
<%= f.submit l(:label_submit),:class => "small" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<script>
|
||||
function system_message_length()
|
||||
{
|
||||
var obj = $("#system_message").value;
|
||||
if (obj.length == 0) {
|
||||
$("#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").css('color', '#ff0000');
|
||||
$("#content_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$("#content_notice_span").text("填写正确");
|
||||
$("#content_notice_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function submit_message()
|
||||
{
|
||||
if (system_message_length())
|
||||
{
|
||||
$("#system_message_form").submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -57,12 +57,12 @@
|
|||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to usm.content.html_safe, {:controller => 'system_messages', :action => 'index'},
|
||||
:class => "newsGrey",
|
||||
:class => "newsRed",
|
||||
:onmouseover => "message_titile_show($(this),event);",
|
||||
:onmouseout => "message_titile_hide($(this));"
|
||||
%>
|
||||
</li>
|
||||
<div style="display:none;" class="message_title">
|
||||
<div style="display:none;" class="message_title_red">
|
||||
<%= usm.content.html_safe %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
|
||||
|
@ -356,7 +356,7 @@
|
|||
:onmouseout => "message_titile_hide($(this));"
|
||||
%>
|
||||
</li>
|
||||
<div style="display:none;" class="message_title">
|
||||
<div style="display:none;" class="message_title_red">
|
||||
<%= ma.content.html_safe%>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
|
|
|
@ -15,4 +15,6 @@ zh:
|
|||
label_registration_automatic_activation: 自动激活帐号
|
||||
|
||||
label_system_message: 系统消息
|
||||
label_admin_message_fail: 消息内容过长!
|
||||
label_content_blank_fail: 消息内容不能为空!
|
||||
|
||||
|
|
|
@ -931,6 +931,8 @@ img.ui-datepicker-trigger {
|
|||
margin-bottom: 3px;
|
||||
}
|
||||
.message_title{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;}
|
||||
.message_title_red{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;color: red}
|
||||
|
||||
.description{display: none !important;}
|
||||
.ispublic-label{display: none !important;}
|
||||
.is_public_checkbox{display: none !important;}
|
||||
|
|
Loading…
Reference in New Issue