From 4c3e2376f0fba97865e8151a0e453a434a10b262 Mon Sep 17 00:00:00 2001
From: fanqiang <316257774@qq.com>
Date: Tue, 27 May 2014 16:25:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B8=96=E5=AD=90=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/relative_memo.rb | 5 +++++
app/views/open_source_projects/_show_bug.html.erb | 10 ++++------
app/views/open_source_projects/_show_memo.html.erb | 8 ++++----
app/views/open_source_projects/_show_topics.html.erb | 8 ++++----
4 files changed, 17 insertions(+), 14 deletions(-)
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) %> |