diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-01 16:50:42 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-01 16:50:42 +0000 |
commit | c085367bb63b8e6c6a6143265358374dc395365b (patch) | |
tree | 4145c244d889261c59fd7dc0c2096aeba8d142e8 /app | |
parent | bebe429472f8b760b25d70bc6dca780828326f02 (diff) | |
download | redmine-c085367bb63b8e6c6a6143265358374dc395365b.tar.gz redmine-c085367bb63b8e6c6a6143265358374dc395365b.zip |
Adds css class to custom field input tags.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9608 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 5e63a5634..789d527b5 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -39,15 +39,17 @@ module CustomFieldsHelper field_name << "[]" if custom_field.multiple? field_id = "#{name}_custom_field_values_#{custom_field.id}" + tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"} + field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) case field_format.try(:edit_as) when "date" - text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + + text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) + calendar_for(field_id) when "text" - text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%') + text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3)) when "bool" - hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id) + hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options) when "list" blank_option = '' unless custom_field.multiple? @@ -60,13 +62,13 @@ module CustomFieldsHelper end end s = select_tag(field_name, blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value), - :id => field_id, :multiple => custom_field.multiple?) + tag_options.merge(:multiple => custom_field.multiple?)) if custom_field.multiple? s << hidden_field_tag(field_name, '') end s else - text_field_tag(field_name, custom_value.value, :id => field_id) + text_field_tag(field_name, custom_value.value, tag_options) end end @@ -86,26 +88,28 @@ module CustomFieldsHelper field_name = "#{name}[custom_field_values][#{custom_field.id}]" field_name << "[]" if custom_field.multiple? field_id = "#{name}_custom_field_values_#{custom_field.id}" + + tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"} + field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) case field_format.try(:edit_as) when "date" - text_field_tag(field_name, '', :id => field_id, :size => 10) + + text_field_tag(field_name, '', tag_options.merge(:size => 10)) + calendar_for(field_id) when "text" - text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%') + text_area_tag(field_name, '', tag_options.merge(:rows => 3)) when "bool" select_tag(field_name, options_for_select([[l(:label_no_change_option), ''], [l(:general_text_yes), '1'], - [l(:general_text_no), '0']]), :id => field_id) + [l(:general_text_no), '0']]), tag_options) when "list" options = [] options << [l(:label_no_change_option), ''] unless custom_field.multiple? options << [l(:label_none), '__none__'] unless custom_field.is_required? options += custom_field.possible_values_options(projects) - select_tag(field_name, options_for_select(options), - :id => field_id, :multiple => custom_field.multiple?) + select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?)) else - text_field_tag(field_name, '', :id => field_id) + text_field_tag(field_name, '', tag_options) end end |