Refactor: Move method

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3673 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-04-16 15:33:55 +00:00
parent 88db9d0bdc
commit d22723ed04
2 changed files with 13 additions and 9 deletions

View File

@ -95,15 +95,7 @@ module CustomFieldsHelper
# Return a string used to display a custom value # Return a string used to display a custom value
def format_value(value, field_format) def format_value(value, field_format)
return "" unless value && !value.empty? Redmine::CustomFieldFormat.format_value(value, field_format) # Proxy
case field_format
when "date"
begin; format_date(value.to_date); rescue; value end
when "bool"
l(value == "1" ? :general_text_Yes : :general_text_No)
else
value
end
end end
# Return an array of custom field formats which can be used in select_tag # Return an array of custom field formats which can be used in select_tag

View File

@ -61,6 +61,18 @@ module Redmine
[ l(custom_field_format.label), custom_field_format.name ] [ l(custom_field_format.label), custom_field_format.name ]
} }
end end
def format_value(value, field_format)
return "" unless value && !value.empty?
case field_format
when "date"
begin; format_date(value.to_date); rescue; value end
when "bool"
l(value == "1" ? :general_text_Yes : :general_text_No)
else
value
end
end
end end
end end
end end