1 # redMine - project management software
\r
2 # Copyright (C) 2006 Jean-Philippe Lang
\r
4 # This program is free software; you can redistribute it and/or
\r
5 # modify it under the terms of the GNU General Public License
\r
6 # as published by the Free Software Foundation; either version 2
\r
7 # of the License, or (at your option) any later version.
\r
9 # This program is distributed in the hope that it will be useful,
\r
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 # GNU General Public License for more details.
\r
14 # You should have received a copy of the GNU General Public License
\r
15 # along with this program; if not, write to the Free Software
\r
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 def show_detail(detail, no_html=false)
\r
21 case detail.property
\r
23 label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
\r
24 case detail.prop_key
\r
25 when 'due_date', 'start_date'
\r
26 value = format_date(detail.value.to_date) if detail.value
\r
27 old_value = format_date(detail.old_value.to_date) if detail.old_value
\r
29 s = IssueStatus.find_by_id(detail.value) and value = s.name if detail.value
\r
30 s = IssueStatus.find_by_id(detail.old_value) and old_value = s.name if detail.old_value
\r
31 when 'assigned_to_id'
\r
32 u = User.find_by_id(detail.value) and value = u.name if detail.value
\r
33 u = User.find_by_id(detail.old_value) and old_value = u.name if detail.old_value
\r
35 e = Enumeration.find_by_id(detail.value) and value = e.name if detail.value
\r
36 e = Enumeration.find_by_id(detail.old_value) and old_value = e.name if detail.old_value
\r
38 c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
\r
39 c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
\r
40 when 'fixed_version_id'
\r
41 v = Version.find_by_id(detail.value) and value = v.name if detail.value
\r
42 v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
\r
45 custom_field = CustomField.find_by_id(detail.prop_key)
\r
47 label = custom_field.name
\r
48 value = format_value(detail.value, custom_field.field_format) if detail.value
\r
49 old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
\r
53 label ||= detail.prop_key
\r
54 value ||= detail.value
\r
55 old_value ||= detail.old_value
\r
58 label = content_tag('strong', label)
\r
59 old_value = content_tag("i", old_value) if old_value
\r
60 old_value = content_tag("strike", old_value) if old_value and !value
\r
61 value = content_tag("i", value) if value
\r
66 label + " " + l(:text_journal_changed, old_value, value)
\r
68 label + " " + l(:text_journal_set_to, value)
\r
71 label + " " + l(:text_journal_deleted) + " (#{old_value})"
\r