From f218b873382bfb6853a305016368f745c742c5dd Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 15 May 2014 16:59:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=B8=AD=E7=BC=BA=E9=99=B7=E7=BC=96=E5=8F=B7=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 7 ++++++- app/models/journal.rb | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index b69ac246c..d2332350a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -57,7 +57,7 @@ class Issue < ActiveRecord::Base :include => [:project, :visible_journals], # sort by id so that limited eager loading doesn't break with postgresql :order_column => "#{table_name}.id" - acts_as_event :title => Proc.new {|o| + acts_as_event :title => Proc.new {|o| #"#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}" "#{o.tracker.name} #{o.source_from} (#{o.status}): #{o.subject}" }, @@ -991,6 +991,11 @@ class Issue < ActiveRecord::Base "#{tracker} ##{id}: #{subject}" end + # 缺陷在项目中的序号 + def inProjectIndex + (self.project.issues.index(self).to_i + 1).to_s + end + # Returns a string of css classes that apply to the issue def css_classes s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" diff --git a/app/models/journal.rb b/app/models/journal.rb index 02d313731..0997640d8 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -29,8 +29,8 @@ class Journal < ActiveRecord::Base # end attr_accessor :indice - acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" }, - :description => :notes, + acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.inProjectIndex}#{status}: #{o.issue.subject}" }, + :description =>:notes, :author => :user, :group => :issue, :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' },