修复个人动态首页中留言等动态显示有误的问题
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
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
<% 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>
|
||||
<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 %>
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
<!-- <tr><div class="line_under"></div></tr> -->
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</table><% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue