parent
64bce0261d
commit
8c0f9d24f8
|
@ -44,6 +44,13 @@ class SystemMessagesController < ApplicationController
|
||||||
if @system_messages.save
|
if @system_messages.save
|
||||||
format.html {redirect_to user_message_path(User.current, :type => "system_message")}
|
format.html {redirect_to user_message_path(User.current, :type => "system_message")}
|
||||||
flash[:notice] = l(:notice_successful_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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
class SystemMessage < ActiveRecord::Base
|
class SystemMessage < ActiveRecord::Base
|
||||||
attr_accessible :content, :id, :user_id
|
attr_accessible :content, :id, :user_id
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
validates :content, presence: true
|
||||||
validates_length_of :content, maximum: 255
|
validates_length_of :content, maximum: 255
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,50 +4,16 @@
|
||||||
<%=l(:label_system_message)%>
|
<%=l(:label_system_message)%>
|
||||||
</h3><br/>
|
</h3><br/>
|
||||||
<div style="padding-top: 20px; padding-left: 5px;">
|
<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">
|
<div class="field">
|
||||||
<%= f.kindeditor :content, :edit_id => 'system_message',
|
<%= f.kindeditor :content, :edit_id => 'system_message', :width => '87%', :resizeType => '0', :no_label => true %>
|
||||||
:width => '87%',
|
|
||||||
:resizeType => '0',
|
|
||||||
:no_label => true
|
|
||||||
%>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p id="content_notice_span" class="ml55"></p>
|
<p id="content_notice_span" class="ml55"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<%= f.submit l(:label_submit),:class => "small", :onclick => "system_message.sync;" %>
|
<%= f.submit l(:label_submit),:class => "small" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</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>
|
||||||
<li class="homepageNewsContent fl">
|
<li class="homepageNewsContent fl">
|
||||||
<%= link_to usm.content.html_safe, {:controller => 'system_messages', :action => 'index'},
|
<%= link_to usm.content.html_safe, {:controller => 'system_messages', :action => 'index'},
|
||||||
:class => "newsGrey",
|
:class => "newsRed",
|
||||||
:onmouseover => "message_titile_show($(this),event);",
|
:onmouseover => "message_titile_show($(this),event);",
|
||||||
:onmouseout => "message_titile_hide($(this));"
|
:onmouseout => "message_titile_hide($(this));"
|
||||||
%>
|
%>
|
||||||
</li>
|
</li>
|
||||||
<div style="display:none;" class="message_title">
|
<div style="display:none;" class="message_title_red">
|
||||||
<%= usm.content.html_safe %>
|
<%= usm.content.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
|
||||||
|
@ -356,7 +356,7 @@
|
||||||
:onmouseout => "message_titile_hide($(this));"
|
:onmouseout => "message_titile_hide($(this));"
|
||||||
%>
|
%>
|
||||||
</li>
|
</li>
|
||||||
<div style="display:none;" class="message_title">
|
<div style="display:none;" class="message_title_red">
|
||||||
<%= ma.content.html_safe%>
|
<%= ma.content.html_safe%>
|
||||||
</div>
|
</div>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
|
|
|
@ -15,4 +15,6 @@ zh:
|
||||||
label_registration_automatic_activation: 自动激活帐号
|
label_registration_automatic_activation: 自动激活帐号
|
||||||
|
|
||||||
label_system_message: 系统消息
|
label_system_message: 系统消息
|
||||||
|
label_admin_message_fail: 消息内容过长!
|
||||||
|
label_content_blank_fail: 消息内容不能为空!
|
||||||
|
|
||||||
|
|
|
@ -931,6 +931,8 @@ img.ui-datepicker-trigger {
|
||||||
margin-bottom: 3px;
|
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{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;}
|
.description{display: none !important;}
|
||||||
.ispublic-label{display: none !important;}
|
.ispublic-label{display: none !important;}
|
||||||
.is_public_checkbox{display: none !important;}
|
.is_public_checkbox{display: none !important;}
|
||||||
|
|
Loading…
Reference in New Issue