Refactored a bit.

pull/1065/head
Richard 11 years ago
parent 958bbab729
commit c383aa080a
  1. 29
      app/models/work_package.rb

@ -716,26 +716,25 @@ class WorkPackage < ActiveRecord::Base
end
# Begin Custom Value Display Helper Methods
# TODO RS: This probably isn't the right place for display helpers. It's convenient though to have
# the method on the model so that it can be used in the rabl template.
def get_custom_value_display_data(custom_field)
custom_value = custom_values.find_by_custom_field_id(custom_field.id)
if !custom_value.nil?
{
custom_field_id: custom_field.id,
field_format: custom_field.field_format,
value: custom_value.value
}
end
display_custom_value(custom_values.find_by_custom_field_id(custom_field.id))
end
def custom_values_display_data
custom_values.map do |custom_value|
if !custom_value.nil?
{
custom_field_id: custom_value.custom_field.id,
field_format: custom_value.custom_field.field_format,
value: custom_value.value
}
end
display_custom_value(custom_value)
end
end
def display_custom_value(custom_value)
if !custom_value.nil?
{
custom_field_id: custom_value.custom_field.id,
field_format: custom_value.custom_field.field_format,
value: custom_value.value
}
end
end
# End Custom Value Display Helper Methods

Loading…
Cancel
Save