]> source.dussan.org Git - redmine.git/commitdiff
Key/value-pair custom field type not available to all customizable contents (#27543).
authorGo MAEDA <maeda@farend.jp>
Thu, 16 May 2024 08:38:04 +0000 (08:38 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 16 May 2024 08:38:04 +0000 (08:38 +0000)
Patch by Felix Schäfer (@felix) and Takenori TAKAKI (@takenory).

git-svn-id: https://svn.redmine.org/redmine/trunk@22834 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/field_format.rb
test/unit/lib/redmine/field_format/enumeration_format_test.rb
test/unit/lib/redmine/field_format/field_format_test.rb

index 9ee57cca81b500ccd40aa5a4fa382b50b80fe434..148cccadc88826c67086990f543feb0db86d0ec9 100644 (file)
@@ -829,6 +829,8 @@ module Redmine
     end
 
     class EnumerationFormat < RecordList
+      self.customized_class_names = nil
+
       add 'enumeration'
       self.form_partial = 'custom_fields/formats/enumeration'
 
index 74a637fc4127266597d769fff396850cf325e9f0..fdae2ff6f269344829386eb0c655e0f8fb60d2d6 100644 (file)
@@ -98,4 +98,8 @@ class Redmine::EnumerationFieldFormatTest < ActionView::TestCase
     assert_equal [@foo.id], @field.value_from_keyword('foo, baz', nil)
     assert_equal [], @field.value_from_keyword('baz', nil)
   end
+
+  def test_customized_class_names_should_overrided_to_nil
+    assert_nil Redmine::FieldFormat::EnumerationFormat.customized_class_names
+  end
 end
index f71d83e3401003b906ff45fdb6a5d15bda11be98..6418917f29f333dbafaa8b3aa158ea3a5f448582 100644 (file)
@@ -111,4 +111,10 @@ class Redmine::FieldFormatTest < ActionView::TestCase
     assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
     assert_equal '<a href="http://foo/foo%20bar#anchor" class="external">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
   end
+
+  def test_as_select_should_return_enumeration_for_all_classes
+    %w(Issue TimeEntry Project Version Document User Group TimeEntryActivity IssuePriority DocumentCategory).each do |klass|
+      assert_include ['Key/value list', 'enumeration'], Redmine::FieldFormat.as_select(klass)
+    end
+  end
 end