##// END OF EJS Templates
Refactor: Remove duplicated case statements....
Eric Davis -
r3440:c07696b57896
parent child
Show More
@@ -69,32 +69,16 module IssuesHelper
69 when 'attr'
69 when 'attr'
70 field = detail.prop_key.to_s.gsub(/\_id$/, "")
70 field = detail.prop_key.to_s.gsub(/\_id$/, "")
71 label = l(("field_" + field).to_sym)
71 label = l(("field_" + field).to_sym)
72 case detail.prop_key
72 case
73 when 'due_date', 'start_date'
73 when ['due_date', 'start_date'].include?(detail.prop_key)
74 value = format_date(detail.value.to_date) if detail.value
74 value = format_date(detail.value.to_date) if detail.value
75 old_value = format_date(detail.old_value.to_date) if detail.old_value
75 old_value = format_date(detail.old_value.to_date) if detail.old_value
76 when 'project_id'
76
77 value = find_name_by_reflection(field, detail.value)
77 when ['project_id', 'status_id', 'tracker_id', 'assigned_to_id', 'priority_id', 'category_id', 'fixed_version_id'].include?(detail.prop_key)
78 old_value = find_name_by_reflection(field, detail.old_value)
79 when 'status_id'
80 value = find_name_by_reflection(field, detail.value)
81 old_value = find_name_by_reflection(field, detail.old_value)
82 when 'tracker_id'
83 value = find_name_by_reflection(field, detail.value)
84 old_value = find_name_by_reflection(field, detail.old_value)
85 when 'assigned_to_id'
86 value = find_name_by_reflection(field, detail.value)
87 old_value = find_name_by_reflection(field, detail.old_value)
88 when 'priority_id'
89 value = find_name_by_reflection(field, detail.value)
90 old_value = find_name_by_reflection(field, detail.old_value)
91 when 'category_id'
92 value = find_name_by_reflection(field, detail.value)
93 old_value = find_name_by_reflection(field, detail.old_value)
94 when 'fixed_version_id'
95 value = find_name_by_reflection(field, detail.value)
78 value = find_name_by_reflection(field, detail.value)
96 old_value = find_name_by_reflection(field, detail.old_value)
79 old_value = find_name_by_reflection(field, detail.old_value)
97 when 'estimated_hours'
80
81 when detail.prop_key == 'estimated_hours'
98 value = "%0.02f" % detail.value.to_f unless detail.value.blank?
82 value = "%0.02f" % detail.value.to_f unless detail.value.blank?
99 old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
83 old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
100 end
84 end
General Comments 0
You need to be logged in to leave comments. Login now