diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-08 16:47:57 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-08 16:47:57 +0000 |
commit | c07696b578960701c388002612308dcd4db57ec8 (patch) | |
tree | a60cbe0f2e55e188ce368259c5c9b8616f3684a3 | |
parent | 43e3c43cbdcf948e6a06dd37dc5b7e44d5ee5838 (diff) | |
download | redmine-c07696b578960701c388002612308dcd4db57ec8.tar.gz redmine-c07696b578960701c388002612308dcd4db57ec8.zip |
Refactor: Remove duplicated case statements.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3554 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/issues_helper.rb | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index e90225f8d..8124add12 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -69,32 +69,16 @@ module IssuesHelper when 'attr' field = detail.prop_key.to_s.gsub(/\_id$/, "") label = l(("field_" + field).to_sym) - case detail.prop_key - when 'due_date', 'start_date' + case + when ['due_date', 'start_date'].include?(detail.prop_key) value = format_date(detail.value.to_date) if detail.value old_value = format_date(detail.old_value.to_date) if detail.old_value - when 'project_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'status_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'tracker_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'assigned_to_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'priority_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'category_id' - value = find_name_by_reflection(field, detail.value) - old_value = find_name_by_reflection(field, detail.old_value) - when 'fixed_version_id' + + when ['project_id', 'status_id', 'tracker_id', 'assigned_to_id', 'priority_id', 'category_id', 'fixed_version_id'].include?(detail.prop_key) value = find_name_by_reflection(field, detail.value) old_value = find_name_by_reflection(field, detail.old_value) - when 'estimated_hours' + + when detail.prop_key == 'estimated_hours' value = "%0.02f" % detail.value.to_f unless detail.value.blank? old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank? end |