Skip to content
Browse files

Add support so that each input type is marked with the type as a clas…

…s for ie6 support
  • Loading branch information...
1 parent 7e90d12 commit 150b249e0b5ddf19e6440aa3ac8704446b8c4725 @nesquena committed Jan 7, 2009
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/semantic_fields_renderer.rb
View
9 lib/semantic_fields_renderer.rb
@@ -92,7 +92,7 @@ def image_submit_tag(image_file, options={})
content_tag(:dd, :class => 'button') do
@super.image_submit_tag(image_file, options)
end
- end
+ end
# ===============================================================
@@ -115,7 +115,7 @@ def self.create_field_element(input_type)
define_method(field_tag_name) do |name, *args| # defines a method called 'semantic_text_field_tag'
field_helper_method = method(field_tag_name.intern)
- options = field_tag_item_options(name, args[0]) # grab the options hash
+ options = field_tag_item_options(name, input_type, args[0]) # grab the options hash
html = content_tag(:dt) do
content_tag(:label , "#{options.delete(:label)}:", :for => options[:id])
@@ -143,11 +143,12 @@ def self.create_field_element(input_type)
#
# returns => { :value => 'field_value', :label => "some string", :id => 'some_id', ... }
#
- def field_tag_item_options(element_name, options)
- result_options = (options || {}).dup
+ def field_tag_item_options(element_name, input_type, options)
+ result_options = (options || { :class => "" }).dup
result_options[:id] ||= element_name
result_options[:label] ||= element_name.to_s.titleize
result_options[:value] ||= nil
+ result_options[:class] << " #{input_type}"
result_options
end

0 comments on commit 150b249

Please sign in to comment.
Something went wrong with that request. Please try again.