diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb index 073d1ca12..f087fce2b 100644 --- a/app/models/relative_memo.rb +++ b/app/models/relative_memo.rb @@ -70,6 +70,11 @@ class RelativeMemo < ActiveRecord::Base def cannot_reply_to_locked_topic errors.add :base, l(:label_memo_locked) if root.locked? && self != root end + + def short_content(length = 25) + str = "^(.{,#{length}})[^\n\r]*.*$" + content.gsub(Regexp.new(str), '\1...').strip if content + end # def update_memos_forum # if forum_id_changed? diff --git a/app/views/open_source_projects/_show_bug.html.erb b/app/views/open_source_projects/_show_bug.html.erb index 05a1fc6cc..7407c115d 100644 --- a/app/views/open_source_projects/_show_bug.html.erb +++ b/app/views/open_source_projects/_show_bug.html.erb @@ -51,20 +51,18 @@ - + <%= topic.short_content(70) %> - <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> + <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
- 帖子来源:<%=link_to 'OSChina', topic.url %> + 帖子来源:<%=link_to 'OSChina', topic.url %> - <%= no_use_link(topic, User.current) %> + <%= no_use_link(topic, User.current) %> - - diff --git a/app/views/open_source_projects/_show_memo.html.erb b/app/views/open_source_projects/_show_memo.html.erb index 05a1fc6cc..5fa9cb9d4 100644 --- a/app/views/open_source_projects/_show_memo.html.erb +++ b/app/views/open_source_projects/_show_memo.html.erb @@ -51,17 +51,17 @@ - + - <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> + <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
- 帖子来源:<%=link_to 'OSChina', topic.url %> + 帖子来源:<%=link_to 'OSChina', topic.url %> - <%= no_use_link(topic, User.current) %> + <%= no_use_link(topic, User.current) %> diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb index 1a004133f..dacc9b013 100644 --- a/app/views/open_source_projects/_show_topics.html.erb +++ b/app/views/open_source_projects/_show_topics.html.erb @@ -467,17 +467,17 @@ - + - <%=user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> + <%=user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
- 帖子来源:<%=link_to 'OSChina', topic.url %> + 帖子来源:<%=link_to 'OSChina', topic.url %> - <%= no_use_link(topic, User.current) %> + <%= no_use_link(topic, User.current) %>