修正项目动态中缺陷编号错误的问题

This commit is contained in:
nwb 2014-05-15 16:59:15 +08:00
parent f1b086ef90
commit f218b87338
2 changed files with 8 additions and 3 deletions

View File

@ -57,7 +57,7 @@ class Issue < ActiveRecord::Base
:include => [:project, :visible_journals], :include => [:project, :visible_journals],
# sort by id so that limited eager loading doesn't break with postgresql # sort by id so that limited eager loading doesn't break with postgresql
:order_column => "#{table_name}.id" :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.id} (#{o.status}): #{o.subject}"
"#{o.tracker.name} #{o.source_from} (#{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}" "#{tracker} ##{id}: #{subject}"
end 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 # Returns a string of css classes that apply to the issue
def css_classes def css_classes
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"

View File

@ -29,8 +29,8 @@ class Journal < ActiveRecord::Base
# end # end
attr_accessor :indice 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}" }, 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, :description =>:notes,
:author => :user, :author => :user,
:group => :issue, :group => :issue,
:type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' }, :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' },