##// END OF EJS Templates
Small fix in issue history display....
Jean-Philippe Lang -
r684:3ae8c53cbaf3
parent child
Show More
@@ -1,86 +1,86
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
2 # Copyright (C) 2006 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
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 module IssuesHelper
18 module IssuesHelper
19
19
20 def show_detail(detail, no_html=false)
20 def show_detail(detail, no_html=false)
21 case detail.property
21 case detail.property
22 when 'attr'
22 when 'attr'
23 label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
23 label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
24 case detail.prop_key
24 case detail.prop_key
25 when 'due_date', 'start_date'
25 when 'due_date', 'start_date'
26 value = format_date(detail.value.to_date) if detail.value
26 value = format_date(detail.value.to_date) if detail.value
27 old_value = format_date(detail.old_value.to_date) if detail.old_value
27 old_value = format_date(detail.old_value.to_date) if detail.old_value
28 when 'status_id'
28 when 'status_id'
29 s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
29 s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
30 s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
30 s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
31 when 'assigned_to_id'
31 when 'assigned_to_id'
32 u = User.find_by_id(detail.value) and value = u.name if detail.value
32 u = User.find_by_id(detail.value) and value = u.name if detail.value
33 u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
33 u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
34 when 'priority_id'
34 when 'priority_id'
35 e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value
35 e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value
36 e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
36 e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
37 when 'category_id'
37 when 'category_id'
38 c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
38 c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
39 c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
39 c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
40 when 'fixed_version_id'
40 when 'fixed_version_id'
41 v = Version.find_by_id(detail.value) and value = v.name if detail.value
41 v = Version.find_by_id(detail.value) and value = v.name if detail.value
42 v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
42 v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
43 end
43 end
44 when 'cf'
44 when 'cf'
45 custom_field = CustomField.find_by_id(detail.prop_key)
45 custom_field = CustomField.find_by_id(detail.prop_key)
46 if custom_field
46 if custom_field
47 label = custom_field.name
47 label = custom_field.name
48 value = format_value(detail.value, custom_field.field_format) if detail.value
48 value = format_value(detail.value, custom_field.field_format) if detail.value
49 old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
49 old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
50 end
50 end
51 when 'attachment'
51 when 'attachment'
52 label = l(:label_attachment)
52 label = l(:label_attachment)
53 end
53 end
54
54
55 label ||= detail.prop_key
55 label ||= detail.prop_key
56 value ||= detail.value
56 value ||= detail.value
57 old_value ||= detail.old_value
57 old_value ||= detail.old_value
58
58
59 unless no_html
59 unless no_html
60 label = content_tag('strong', label)
60 label = content_tag('strong', label)
61 old_value = content_tag("i", h(old_value)) if detail.old_value
61 old_value = content_tag("i", h(old_value)) if detail.old_value
62 old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
62 old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)
63 value = content_tag("i", h(value)) if value
63 value = content_tag("i", h(value)) if value
64 end
64 end
65
65
66 if detail.value and !detail.value.to_s.empty?
66 if !detail.value.blank?
67 case detail.property
67 case detail.property
68 when 'attr', 'cf'
68 when 'attr', 'cf'
69 if old_value
69 if !detail.old_value.blank?
70 label + " " + l(:text_journal_changed, old_value, value)
70 label + " " + l(:text_journal_changed, old_value, value)
71 else
71 else
72 label + " " + l(:text_journal_set_to, value)
72 label + " " + l(:text_journal_set_to, value)
73 end
73 end
74 when 'attachment'
74 when 'attachment'
75 "#{label} #{value} #{l(:label_added)}"
75 "#{label} #{value} #{l(:label_added)}"
76 end
76 end
77 else
77 else
78 case detail.property
78 case detail.property
79 when 'attr', 'cf'
79 when 'attr', 'cf'
80 label + " " + l(:text_journal_deleted) + " (#{old_value})"
80 label + " " + l(:text_journal_deleted) + " (#{old_value})"
81 when 'attachment'
81 when 'attachment'
82 "#{label} #{old_value} #{l(:label_deleted)}"
82 "#{label} #{old_value} #{l(:label_deleted)}"
83 end
83 end
84 end
84 end
85 end
85 end
86 end
86 end
General Comments 0
You need to be logged in to leave comments. Login now