comparison app/models/issue_relation.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 # Class used to represent the relations of an issue 18 class IssueRelation < ActiveRecord::Base
19 class IssueRelations < Array 19 # Class used to represent the relations of an issue
20 include Redmine::I18n 20 class Relations < Array
21 include Redmine::I18n
21 22
22 def initialize(issue, *args) 23 def initialize(issue, *args)
23 @issue = issue 24 @issue = issue
24 super(*args) 25 super(*args)
26 end
27
28 def to_s(*args)
29 map {|relation| "#{l(relation.label_for(@issue))} ##{relation.other_issue(@issue).id}"}.join(', ')
30 end
25 end 31 end
26 32
27 def to_s(*args)
28 map {|relation| "#{l(relation.label_for(@issue))} ##{relation.other_issue(@issue).id}"}.join(', ')
29 end
30 end
31
32 class IssueRelation < ActiveRecord::Base
33 belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id' 33 belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
34 belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id' 34 belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'
35 35
36 TYPE_RELATES = "relates" 36 TYPE_RELATES = "relates"
37 TYPE_DUPLICATES = "duplicates" 37 TYPE_DUPLICATES = "duplicates"