diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 173e0d5f8..5153c1489 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -138,7 +138,11 @@ module CustomFieldsHelper
end unless custom_values.empty?
end
- def edit_tag_style_tag(form)
- form.select :edit_tag_style, [[l(:label_drop_down_list), ''], [l(:label_checkboxes), 'check_box']], :label => :label_display
+ def edit_tag_style_tag(form, options={})
+ select_options = [[l(:label_drop_down_list), ''], [l(:label_checkboxes), 'check_box']]
+ if options[:include_radio]
+ select_options << [l(:label_radio_buttons), 'radio']
+ end
+ form.select :edit_tag_style, select_options, :label => :label_display
end
end
diff --git a/app/views/custom_fields/formats/_bool.html.erb b/app/views/custom_fields/formats/_bool.html.erb
index 81aa64afe..3b791acfe 100644
--- a/app/views/custom_fields/formats/_bool.html.erb
+++ b/app/views/custom_fields/formats/_bool.html.erb
@@ -1,3 +1,3 @@
<%= f.select :default_value, [[]]+@custom_field.possible_values_options %>
<%= f.text_field :url_pattern, :size => 50, :label => :label_link_values_to %>
-<%= edit_tag_style_tag f %>
+<%= edit_tag_style_tag f, :include_radio => true %>
diff --git a/config/locales/ar.yml b/config/locales/ar.yml
index e83e70b29..04668d0e7 100644
--- a/config/locales/ar.yml
+++ b/config/locales/ar.yml
@@ -1115,3 +1115,4 @@ ar:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/az.yml b/config/locales/az.yml
index 970bd0ac9..c4881f0e6 100644
--- a/config/locales/az.yml
+++ b/config/locales/az.yml
@@ -1212,3 +1212,4 @@ az:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 618eeb04d..9400e23f1 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -1109,3 +1109,4 @@ bg:
description_date_from: Въведете начална дата
description_date_to: Въведете крайна дата
text_repository_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.
Промяна след създаването му не е възможна.'
+ label_radio_buttons: radio buttons
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index 952149303..80b7b5ee8 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -1128,3 +1128,4 @@ bs:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 6f1c3e3f2..2f9b512f5 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -1117,3 +1117,4 @@ ca:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 6db8280c8..2e902c364 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -1117,3 +1117,4 @@ cs:
label_check_for_updates: Zkontroluj aktualizace
label_latest_compatible_version: Poslední kompatibilní verze
label_unknown_plugin: Nezámý plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/da.yml b/config/locales/da.yml
index a5b19cf27..02d10f0bf 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -1132,3 +1132,4 @@ da:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 58bb692c3..d63d78abd 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -1124,3 +1124,4 @@ de:
version_status_open: offen
warning_attachments_not_saved: "%{count} Datei(en) konnten nicht gespeichert werden."
+ label_radio_buttons: radio buttons
diff --git a/config/locales/el.yml b/config/locales/el.yml
index a57092160..785eb8d28 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -1115,3 +1115,4 @@ el:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index 04ecfe1b1..a257d9acc 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -1117,3 +1117,4 @@ en-GB:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/en.yml b/config/locales/en.yml
index fc5072cf6..e28b8e729 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -909,6 +909,7 @@ en:
label_only: only
label_drop_down_list: drop-down list
label_checkboxes: checkboxes
+ label_radio_buttons: radio buttons
label_link_values_to: Link values to URL
label_custom_field_select_type: Select the type of object to which the custom field is to be attached
label_check_for_updates: Check for updates
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 0b41e49a4..804f61e56 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -1148,3 +1148,4 @@ es:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/et.yml b/config/locales/et.yml
index 12e963e0a..56ecd78b6 100644
--- a/config/locales/et.yml
+++ b/config/locales/et.yml
@@ -1128,3 +1128,4 @@ et:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/eu.yml b/config/locales/eu.yml
index c36091f42..930081461 100644
--- a/config/locales/eu.yml
+++ b/config/locales/eu.yml
@@ -1116,3 +1116,4 @@ eu:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index 687d77b4c..faff21fca 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -1117,3 +1117,4 @@ fa:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 35e7977eb..b31ae68f5 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -1136,3 +1136,4 @@ fi:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 57bbd491f..c9213adaa 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -885,6 +885,7 @@ fr:
label_only: seulement
label_drop_down_list: liste déroulante
label_checkboxes: cases à cocher
+ label_radio_buttons: boutons radio
label_link_values_to: Lier les valeurs vers l'URL
label_custom_field_select_type: Selectionner le type d'objet auquel attacher le champ personnalisé
label_check_for_updates: Vérifier les mises à jour
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 89ff42631..e3859dfee 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -1126,3 +1126,4 @@ gl:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/he.yml b/config/locales/he.yml
index eda59b18e..843354d3c 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -1120,3 +1120,4 @@ he:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 2483f3b40..a21fe8cd8 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1116,3 +1116,4 @@ hr:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index fdf42e286..4768c7939 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -1134,3 +1134,4 @@
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/id.yml b/config/locales/id.yml
index a46064be8..eee676d5d 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -1119,3 +1119,4 @@ id:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/it.yml b/config/locales/it.yml
index e7a9eb0ea..92efb5c6b 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -1114,3 +1114,4 @@ it:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index e896873aa..fef14ef30 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1139,3 +1139,4 @@ ja:
label_check_for_updates: アップデートを確認
label_latest_compatible_version: 互換性のある最新バージョン
label_unknown_plugin: 不明なプラグイン
+ label_radio_buttons: radio buttons
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 53c84f701..03129ac02 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -1159,3 +1159,4 @@ ko:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index ad731b49f..da6af8a18 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -1174,3 +1174,4 @@ lt:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/lv.yml b/config/locales/lv.yml
index cf00b755c..328325a98 100644
--- a/config/locales/lv.yml
+++ b/config/locales/lv.yml
@@ -1109,3 +1109,4 @@ lv:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/mk.yml b/config/locales/mk.yml
index 9a517be11..f45858dcc 100644
--- a/config/locales/mk.yml
+++ b/config/locales/mk.yml
@@ -1115,3 +1115,4 @@ mk:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/mn.yml b/config/locales/mn.yml
index 35a11c224..4ea477f68 100644
--- a/config/locales/mn.yml
+++ b/config/locales/mn.yml
@@ -1116,3 +1116,4 @@ mn:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 83181133e..c07fa305f 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -1094,3 +1094,4 @@ nl:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/no.yml b/config/locales/no.yml
index c13530174..783972907 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -1105,3 +1105,4 @@
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index f38cb43e5..4b623ee34 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -1135,3 +1135,4 @@ pl:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index cbb9deb9a..10d0407e1 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -1134,3 +1134,4 @@ pt-BR:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 88aec01b4..914122727 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -1121,3 +1121,4 @@ pt:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 09f11b189..e46759e8c 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -1110,3 +1110,4 @@ ro:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index d49608079..734f7beb4 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -1221,3 +1221,4 @@ ru:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 509209d45..4210e17c9 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -1105,3 +1105,4 @@ sk:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 18d4a44d2..148f1c87c 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -1115,3 +1115,4 @@ sl:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sq.yml b/config/locales/sq.yml
index 132867018..bf196218d 100644
--- a/config/locales/sq.yml
+++ b/config/locales/sq.yml
@@ -1111,3 +1111,4 @@ sq:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml
index d7d6a05a5..959aebdce 100644
--- a/config/locales/sr-YU.yml
+++ b/config/locales/sr-YU.yml
@@ -1117,3 +1117,4 @@ sr-YU:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index fc743137e..d19063744 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -1116,3 +1116,4 @@ sr:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index 9f2dae972..b0144a70c 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -1153,3 +1153,4 @@ sv:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/th.yml b/config/locales/th.yml
index ef77747aa..40f5e225f 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -1112,3 +1112,4 @@ th:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index a2748b57b..879815ce5 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -1124,3 +1124,4 @@ tr:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 70c6ff14a..75c6bc609 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -1110,3 +1110,4 @@ uk:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index c6e5b3402..15e9dffb8 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -1168,3 +1168,4 @@ vi:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 9b38f474d..b229e0c99 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -1192,3 +1192,4 @@
description_date_from: 輸入起始日期
description_date_to: 輸入結束日期
text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。
一旦儲存之後, 代碼便無法再次被更改。'
+ label_radio_buttons: radio buttons
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index b8ec9548f..d01f0111f 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1116,3 +1116,4 @@ zh:
label_check_for_updates: Check for updates
label_latest_compatible_version: Latest compatible version
label_unknown_plugin: Unknown plugin
+ label_radio_buttons: radio buttons
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index f5e642628..b71a79f9b 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -566,6 +566,25 @@ module Redmine
def group_statement(custom_field)
order_statement(custom_field)
end
+
+ def edit_tag(view, tag_id, tag_name, custom_value, options={})
+ case custom_value.custom_field.edit_tag_style
+ when 'check_box'
+ single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options)
+ when 'radio'
+ check_box_edit_tag(view, tag_id, tag_name, custom_value, options)
+ else
+ select_edit_tag(view, tag_id, tag_name, custom_value, options)
+ end
+ end
+
+ # Renders the edit tag as a simple check box
+ def single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options={})
+ s = ''.html_safe
+ s << view.hidden_field_tag(tag_name, '0', :id => nil)
+ s << view.check_box_tag(tag_name, '1', custom_value.value.to_s == '1', :id => tag_id)
+ view.content_tag('span', s, options)
+ end
end
class RecordList < List
diff --git a/test/unit/lib/redmine/field_format/bool_format_test.rb b/test/unit/lib/redmine/field_format/bool_format_test.rb
new file mode 100644
index 000000000..e5373a519
--- /dev/null
+++ b/test/unit/lib/redmine/field_format/bool_format_test.rb
@@ -0,0 +1,63 @@
+# Redmine - project management software
+# Copyright (C) 2006-2014 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require File.expand_path('../../../../../test_helper', __FILE__)
+require 'redmine/field_format'
+
+class Redmine::BoolFieldFormatTest < ActionView::TestCase
+ include ApplicationHelper
+ include Redmine::I18n
+
+ def setup
+ set_language_if_valid 'en'
+ end
+
+ def test_check_box_style_should_render_edit_tag_as_check_box
+ field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'check_box')
+ value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
+
+ tag = field.format.edit_tag(self, 'abc', 'xyz', value)
+ assert_select_in tag, 'input[name=xyz]', 2
+ assert_select_in tag, 'input[id=abc]', 1
+ assert_select_in tag, 'input[type=hidden][value=0]'
+ assert_select_in tag, 'input[type=checkbox][value=1]'
+ end
+
+ def test_check_box_should_be_checked_when_value_is_set
+ field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'check_box')
+ value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new, :value => '1')
+
+ tag = field.format.edit_tag(self, 'abc', 'xyz', value)
+ assert_select_in tag, 'input[type=checkbox][value=1][checked=checked]'
+ end
+
+ def test_radio_style_should_render_edit_tag_as_radio_buttons
+ field = IssueCustomField.new(:field_format => 'bool', :is_required => false, :edit_tag_style => 'radio')
+ value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
+
+ tag = field.format.edit_tag(self, 'abc', 'xyz', value)
+ assert_select_in tag, 'input[type=radio][name=xyz]', 3
+ end
+
+ def test_default_style_should_render_edit_tag_as_select
+ field = IssueCustomField.new(:field_format => 'bool', :is_required => false)
+ value = CustomFieldValue.new(:custom_field => field, :customized => Issue.new)
+
+ tag = field.format.edit_tag(self, 'abc', 'xyz', value)
+ assert_select_in tag, 'select[name=xyz]', 1
+ end
+end