Index: test/functional/custom_fields_controller_test.rb =================================================================== --- test/functional/custom_fields_controller_test.rb (revision 12224) +++ test/functional/custom_fields_controller_test.rb (working copy) @@ -80,6 +80,22 @@ assert_select '[name=?]', 'custom_field[default_value]', 0 end + def test_searchable_should_be_present_for_string_text_list_custom_field_formats_only + searchable_klasses = %w( IssueCustomField ProjectCustomField ) + Redmine::CustomFieldFormat.available_formats.each do |format| + searchable_klasses.each do |sk| + get :new, :type => sk, :custom_field => {:field_format => format} + assert_response :success + case format + when 'string', 'text', 'list' + assert_select 'input[name=?][type=checkbox]', 'custom_field[searchable]', 1, format + " " + sk + " doesn't present searchable while it should" + when 'int', 'float', 'date', 'bool', 'user', 'version' + assert_select 'input[name=?][type=checkbox]', 'custom_field[searchable]', 0, format + " " + sk + " presents searchable while it shouldn't" + end + end + end + end + def test_new_js get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js' assert_response :success Index: app/views/custom_fields/_form.html.erb =================================================================== --- app/views/custom_fields/_form.html.erb (revision 12224) +++ app/views/custom_fields/_form.html.erb (working copy) @@ -63,7 +63,9 @@

<%= f.check_box :is_required %>

<%= f.check_box :is_for_all %>

<%= f.check_box :is_filter %>

-

<%= f.check_box :searchable %>

+ <% unless @custom_field.format_in? 'int', 'float', 'date', 'bool', 'user', 'version' %> +

<%= f.check_box :searchable %>

+ <% end %>

<%= f.check_box :is_required %>

<%= f.check_box :visible %>

-

<%= f.check_box :searchable %>

+ <% unless @custom_field.format_in? 'int', 'float', 'date', 'bool', 'user', 'version' %> +

<%= f.check_box :searchable %>

+ <% end %>

<%= f.check_box :is_filter %>

<% when "VersionCustomField" %>