消息列表的html标签

This commit is contained in:
cxt 2016-07-15 16:52:18 +08:00
parent dbc8f87346
commit 5b070b6acc
2 changed files with 3 additions and 2 deletions

View File

@ -3289,7 +3289,7 @@ def strip_html(text,len=0,endss="...")
ss = ""
if !text.nil? && text.length>0
ss=text.gsub(/<\/?.*?>/, '').strip
ss = ss.gsub(/&nbsp;/, ' ')
ss = ss.gsub(/&nbsp;*/, ' ')
if len > 0 && ss.length > len
ss = ss[0, len] + endss
@ -3303,6 +3303,7 @@ end
def message_content content
content = (strip_html content).strip
content = content.gsub(/\s+/, " ")
if content.gsub(" ", "") == ""
content = "[非文本消息]"
end

View File

@ -9,7 +9,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
</li>
<li class="homepageNewsContent fl">
<%= link_to ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>
<%= link_to message_content(ma.journals_for_message.notes), feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>
</li>
<div style="display: none" class="message_title_red system_message_style" >
<% if ma.journals_for_message.reply_id == 0 %>