]> source.dussan.org Git - redmine.git/commitdiff
Merged r13167 (#16798).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 26 Jun 2014 19:34:12 +0000 (19:34 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 26 Jun 2014 19:34:12 +0000 (19:34 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@13191 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/field_format.rb
test/unit/lib/redmine/field_format/list_format_test.rb

index 655e2c98499ae6ab35c82ec6b79db917a064a3d8..f5e6426287c1b1353c5601c7188219578354561b 100644 (file)
@@ -498,6 +498,9 @@ module Redmine
           tag_id = nil
           s << view.content_tag('label', tag + ' ' + label) 
         end
+        if custom_value.custom_field.multiple?
+          s << view.hidden_field_tag(tag_name, '')
+        end
         css = "#{options[:class]} check_box_group"
         view.content_tag('span', s, options.merge(:class => css))
       end
index 7be9844381e10414d64cf6f6dff295a7dd58c9fd..adc8d8fe8e6ebbb3efd7b6ec5c14a38bd42c9616 100644 (file)
@@ -116,6 +116,18 @@ class Redmine::ListFieldFormatTest < ActionView::TestCase
     end
   end
 
+  def test_edit_tag_with_check_box_style_and_multiple_values_should_contain_hidden_field_to_clear_value
+    field = IssueCustomField.new(:field_format => 'list', :possible_values => ['Foo', 'Bar'], :is_required => false,
+      :edit_tag_style => 'check_box', :multiple => true)
+    value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
+
+    tag = field.format.edit_tag(self, 'id', 'name', value)
+    assert_select_in tag, 'span' do
+      assert_select 'input[type=checkbox]', 2
+      assert_select 'input[type=hidden]', 1
+    end
+  end
+
   def test_field_with_url_pattern_should_link_value
     field = IssueCustomField.new(:field_format => 'list', :url_pattern => 'http://localhost/%value%')
     formatted = field.format.formatted_value(self, field, 'foo', Issue.new, true)