@@ -1,86 +1,86 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module IssuesHelper |
|
19 | 19 | |
|
20 | 20 | def show_detail(detail, no_html=false) |
|
21 | 21 | case detail.property |
|
22 | 22 | when 'attr' |
|
23 | 23 | label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym) |
|
24 | 24 | case detail.prop_key |
|
25 | 25 | when 'due_date', 'start_date' |
|
26 | 26 | value = format_date(detail.value.to_date) if detail.value |
|
27 | 27 | old_value = format_date(detail.old_value.to_date) if detail.old_value |
|
28 | 28 | when 'status_id' |
|
29 | 29 | s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value |
|
30 | 30 | s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value |
|
31 | 31 | when 'assigned_to_id' |
|
32 | 32 | u = User.find_by_id(detail.value) and value = u.name if detail.value |
|
33 | 33 | u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value |
|
34 | 34 | when 'priority_id' |
|
35 | 35 | e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value |
|
36 | 36 | e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value |
|
37 | 37 | when 'category_id' |
|
38 | 38 | c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value |
|
39 | 39 | c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value |
|
40 | 40 | when 'fixed_version_id' |
|
41 | 41 | v = Version.find_by_id(detail.value) and value = v.name if detail.value |
|
42 | 42 | v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value |
|
43 | 43 | end |
|
44 | 44 | when 'cf' |
|
45 | 45 | custom_field = CustomField.find_by_id(detail.prop_key) |
|
46 | 46 | if custom_field |
|
47 | 47 | label = custom_field.name |
|
48 | 48 | value = format_value(detail.value, custom_field.field_format) if detail.value |
|
49 | 49 | old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value |
|
50 | 50 | end |
|
51 | 51 | when 'attachment' |
|
52 | 52 | label = l(:label_attachment) |
|
53 | 53 | end |
|
54 | 54 | |
|
55 | 55 | label ||= detail.prop_key |
|
56 | 56 | value ||= detail.value |
|
57 | 57 | old_value ||= detail.old_value |
|
58 | 58 | |
|
59 | 59 | unless no_html |
|
60 | 60 | label = content_tag('strong', label) |
|
61 | 61 | old_value = content_tag("i", h(old_value)) if detail.old_value |
|
62 | 62 | old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?) |
|
63 | 63 | value = content_tag("i", h(value)) if value |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | if detail.value and !detail.value.to_s.empty? | |
|
66 | if !detail.value.blank? | |
|
67 | 67 | case detail.property |
|
68 | 68 | when 'attr', 'cf' |
|
69 | if old_value | |
|
69 | if !detail.old_value.blank? | |
|
70 | 70 | label + " " + l(:text_journal_changed, old_value, value) |
|
71 | 71 | else |
|
72 | 72 | label + " " + l(:text_journal_set_to, value) |
|
73 | 73 | end |
|
74 | 74 | when 'attachment' |
|
75 | 75 | "#{label} #{value} #{l(:label_added)}" |
|
76 | 76 | end |
|
77 | 77 | else |
|
78 | 78 | case detail.property |
|
79 | 79 | when 'attr', 'cf' |
|
80 | 80 | label + " " + l(:text_journal_deleted) + " (#{old_value})" |
|
81 | 81 | when 'attachment' |
|
82 | 82 | "#{label} #{old_value} #{l(:label_deleted)}" |
|
83 | 83 | end |
|
84 | 84 | end |
|
85 | 85 | end |
|
86 | 86 | end |
General Comments 0
You need to be logged in to leave comments.
Login now