From bed662c2e5f77c3df15a243b7a446921d47799dc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 10 Jul 2014 17:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E5=88=97=E8=A1=A8=E6=8F=8F=E8=BF=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E5=B8=B8=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 8 ++++++++ app/views/issues/_list.html.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 550e0dc5d..f47e1c6f9 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -562,6 +562,12 @@ class Issue < ActiveRecord::Base @workflow_rule_by_attribute = result if user.nil? result end + # 缺陷的短描述信息 + def short_description(length = 255) + description.gsub(/<\/?.*?>/,"").html_safe if description + #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + end + private :workflow_rule_by_attribute def done_ratio @@ -1513,4 +1519,6 @@ class Issue < ActiveRecord::Base def be_user_score_new_issue UserScore.project(:post_issue, User.current,self, { issue_id: self.id }) end + + end diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index b36c4b57d..57d8a60cb 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -38,7 +38,7 @@ <% end -%>