修复个人动态首页中留言等动态显示有误的问题
This commit is contained in:
parent
bed662c2e5
commit
4f2298fd22
|
@ -256,8 +256,8 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def format_activity_description(text)
|
||||
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')
|
||||
).gsub(/[\r\n]+/, "<br />").html_safe
|
||||
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />").html_safe
|
||||
#h(truncate(text.to_s, :length => 120).gsub(/<\/?.*?>/,"")).html_safe
|
||||
end
|
||||
|
||||
def format_version_name(version)
|
||||
|
|
|
@ -74,6 +74,12 @@ class News < ActiveRecord::Base
|
|||
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
|
||||
end
|
||||
|
||||
# 新闻的短描述信息
|
||||
def short_description(length = 255)
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<td align="right">
|
||||
<div class="project-search">
|
||||
<%= text_field_tag 'user', params[:user], :size => 30 %>
|
||||
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
||||
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -51,31 +51,31 @@
|
|||
<% case e.act_type %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<% if User.current.login == e.user.try(:login) %>
|
||||
<%# if e.user_id == act.jour.id %>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
||||
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<%# if e.user_id == act.jour.id %>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %>
|
||||
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<%# else %>
|
||||
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong> </td></tr> -->
|
||||
<%# end %>
|
||||
<% else %>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
||||
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
||||
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textilizable act.notes %> </p>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
|
||||
</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textilizable act.notes %> </p>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
|
||||
</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Bid' %>
|
||||
<tr>
|
||||
<% if act.reward_type ==3 %>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -109,7 +109,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.notes %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.notes.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -126,7 +126,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.long_comments %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.long_comments.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -145,11 +145,11 @@
|
|||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Principal' %>
|
||||
|
@ -161,8 +161,8 @@
|
|||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
|
@ -177,7 +177,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -193,7 +193,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable(act.description) %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -251,7 +251,7 @@
|
|||
<td>
|
||||
<table width="580" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
||||
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
||||
<% if e.instance_of?(JournalsForMessage)%>
|
||||
<% if e.reply_id == User.current.id%>
|
||||
<%if e.jour_type == 'Bid'%>
|
||||
|
|
|
@ -39,8 +39,9 @@
|
|||
</tr>
|
||||
<!-- <tr><div class="line_under"></div></tr> -->
|
||||
</table></td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</table><% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue