]> source.dussan.org Git - redmine.git/commitdiff
Let custom field formats control how they are edited.
authorEric Davis <edavis@littlestreamsoftware.com>
Fri, 16 Apr 2010 15:34:05 +0000 (15:34 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Fri, 16 Apr 2010 15:34:05 +0000 (15:34 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3675 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/custom_fields_helper.rb
lib/redmine/custom_field_format.rb

index f75c89382eca6e63461024063ddaaa609dcd8ba5..189467409d27a79b38cd814d6341b4faef475831 100644 (file)
@@ -35,8 +35,9 @@ module CustomFieldsHelper
     custom_field = custom_value.custom_field
     field_name = "#{name}[custom_field_values][#{custom_field.id}]"
     field_id = "#{name}_custom_field_values_#{custom_field.id}"
-    
-    case custom_field.field_format
+
+    field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
+    case field_format.edit_as
     when "date"
       text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + 
       calendar_for(field_id)
@@ -70,7 +71,8 @@ module CustomFieldsHelper
   def custom_field_tag_for_bulk_edit(name, custom_field)
     field_name = "#{name}[custom_field_values][#{custom_field.id}]"
     field_id = "#{name}_custom_field_values_#{custom_field.id}"
-    case custom_field.field_format
+    field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
+    case field_format.edit_as
       when "date"
         text_field_tag(field_name, '', :id => field_id, :size => 10) + 
         calendar_for(field_id)
index 336905666be896995d93331d2fe251011483004a..2f12397d5d1cf3a5a9a3d4036fea223ed01bd81a 100644 (file)
@@ -48,6 +48,13 @@ module Redmine
       }
     end
 
+    # Allow displaying the edit type of another field_format
+    #
+    # Example: display a custom field as a list
+    def edit_as
+      name
+    end
+
     class << self
       def map(&block)
         yield self