@@ -12,7 +12,7 @@ def inject_maxlength_field
1212 end
1313 end
1414 end
15- end if ActionPack :: VERSION :: STRING >= '4'
15+ end
1616
1717
1818module ActionView
@@ -29,7 +29,6 @@ def form_for_with_auto_html5_validation_option(record, options = {}, &proc)
2929 alias_method_chain :form_for , :auto_html5_validation_option
3030 end
3131
32- if ActionPack ::VERSION ::STRING >= '4'
3332 module Tags
3433 class Base #:nodoc:
3534 include Html5Validators ::ActionViewExtension
@@ -70,45 +69,5 @@ def render_with_html5_attributes
7069 end
7170 end
7271 end
73- # ActionPack::VERSION::STRING == '3'
74- else
75- class InstanceTag
76- def to_input_field_tag_with_html5_attributes ( field_type , options = { } )
77- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
78- options [ "required" ] ||= object . class . attribute_required? ( method_name )
79- options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
80- options [ "max" ] ||= object . class . attribute_max ( method_name )
81- options [ "min" ] ||= object . class . attribute_min ( method_name )
82- end
83- to_input_field_tag_without_html5_attributes field_type , options
84- end
85- alias_method_chain :to_input_field_tag , :html5_attributes
86-
87- def to_text_area_tag_with_html5_attributes ( options = { } )
88- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
89- options [ "required" ] ||= object . class . attribute_required? ( method_name )
90- options [ "maxlength" ] ||= object . class . attribute_maxlength ( method_name )
91- end
92- to_text_area_tag_without_html5_attributes options
93- end
94- alias_method_chain :to_text_area_tag , :html5_attributes
95-
96- def to_radio_button_tag_with_html5_attributes ( tag_value , options = { } )
97- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
98- options [ "required" ] ||= object . class . attribute_required? ( method_name )
99- end
100- to_radio_button_tag_without_html5_attributes tag_value , options
101- end
102- alias_method_chain :to_radio_button_tag , :html5_attributes
103-
104- def to_check_box_tag_with_html5_attributes ( options = { } , checked_value = "1" , unchecked_value = "0" )
105- if object . class . ancestors . include? ( ActiveModel ::Validations ) && ( object . auto_html5_validation != false ) && ( object . class . auto_html5_validation != false )
106- options [ "required" ] ||= object . class . attribute_required? ( method_name )
107- end
108- to_check_box_tag_without_html5_attributes options , checked_value , unchecked_value
109- end
110- alias_method_chain :to_check_box_tag , :html5_attributes
111- end
112- end
11372 end
11473end
0 commit comments