diff app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base @ 117:af80e5618e9b redmine-1.1

* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author Chris Cannam
date Thu, 13 Jan 2011 12:53:21 +0000
parents 513646585e45
children cbce1fd3b1b7
line wrap: on
line diff
--- a/app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base	Fri Nov 19 14:05:24 2010 +0000
+++ b/app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base	Thu Jan 13 12:53:21 2011 +0000
@@ -104,4 +104,15 @@
   def custom_field_formats_for_select
     Redmine::CustomFieldFormat.as_select
   end
+  
+  # Renders the custom_values in api views
+  def render_api_custom_values(custom_values, api)
+    api.array :custom_fields do
+      custom_values.each do |custom_value|
+        api.custom_field :id => custom_value.custom_field_id, :name => custom_value.custom_field.name do
+          api.value custom_value.value
+        end
+      end
+    end unless custom_values.empty?
+  end
 end