系统消息修改
This commit is contained in:
parent
06fea1bf1d
commit
9e61ceefa9
|
@ -1,4 +1,5 @@
|
||||||
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_length_of :content, maximum: 255
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<%=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) do |f| %>
|
<%= form_for(@admin_messages, :html => {:id =>'system_message', :multipart => true}) do |f| %>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.kindeditor :content, :edit_id => 'system_message',
|
<%= f.kindeditor :content, :edit_id => 'system_message',
|
||||||
:width => '87%',
|
:width => '87%',
|
||||||
|
@ -11,9 +11,32 @@
|
||||||
:no_label => true
|
:no_label => true
|
||||||
%>
|
%>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<p id="content_notice_span" class="ml55"></p>
|
||||||
|
</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", :onclick => "system_message.sync;" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function system_message_length(obj)
|
||||||
|
{
|
||||||
|
if (obj.length == 0) {
|
||||||
|
$("#content_notice_span").text("内容不能为空");
|
||||||
|
$("#content_notice_span").css('color', '#ff0000');
|
||||||
|
$("#content_notice_span").focus();
|
||||||
|
}
|
||||||
|
else if (obj.length > 255) {
|
||||||
|
$("#content_notice_span").text("内容过长,超过255个字符");
|
||||||
|
$("#content_notice_span").css('color', '#ff0000');
|
||||||
|
$("#content_notice_span").focus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#content_notice_span").text("填写正确");
|
||||||
|
$("#content_notice_span").css('color', '#008000');
|
||||||
|
$("#system_message").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,13 @@
|
||||||
<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 =>"newsGrey",
|
||||||
:title => "#{usm.content.html_safe}" %></li>
|
:onmouseover =>"message_titile_show($(this),event);",
|
||||||
|
:onmouseout => "message_titile_hide($(this));"
|
||||||
|
%>
|
||||||
|
</li>
|
||||||
|
<div style="display:none;" class="message_title">
|
||||||
|
<%= ma.content.html_safe%>
|
||||||
|
</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>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -325,7 +331,13 @@
|
||||||
<li class="homepageNewsContent fl">
|
<li class="homepageNewsContent fl">
|
||||||
<%= link_to ma.content.html_safe, {:controller => 'system_messages', :action => 'index'},
|
<%= link_to ma.content.html_safe, {:controller => 'system_messages', :action => 'index'},
|
||||||
:class =>"newsGrey",
|
:class =>"newsGrey",
|
||||||
:title => "#{ma.content.html_safe}" %></li>
|
:onmouseover =>"message_titile_show($(this),event);",
|
||||||
|
:onmouseout => "message_titile_hide($(this));"
|
||||||
|
%>
|
||||||
|
</li>
|
||||||
|
<div style="display:none;" class="message_title">
|
||||||
|
<%= ma.content.html_safe%>
|
||||||
|
</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>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue