diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-07-05 09:59:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-07-05 09:59:17 +0000 |
commit | b91cbcaa0382362688c59eb192bce46508956f7b (patch) | |
tree | bba9fe7728dac151139f3012673016f867a2e81b /lib/redmine/field_format.rb | |
parent | 0125ba14f6b0c7ff907c8bcadb1cfdf61ed9b157 (diff) | |
download | redmine-b91cbcaa0382362688c59eb192bce46508956f7b.tar.gz redmine-b91cbcaa0382362688c59eb192bce46508956f7b.zip |
Option to render boolean custom fields as a single check box or radio buttons (#17003).
git-svn-id: http://svn.redmine.org/redmine/trunk@13216 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/field_format.rb')
-rw-r--r-- | lib/redmine/field_format.rb | 19 |
1 files changed, 19 insertions, 0 deletions
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 |