Class: ActionView::Helpers::InstanceTag
- Inherits:
-
Object
- Object
- ActionView::Helpers::InstanceTag
- Defined in:
- lib/html5_validators/action_view/form_helpers.rb
Overview
ActionPack::VERSION::STRING == ‘3’
Instance Method Summary collapse
- #to_check_box_tag_with_html5_attributes(options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
- #to_input_field_tag_with_html5_attributes(field_type, options = {}) ⇒ Object
- #to_radio_button_tag_with_html5_attributes(tag_value, options = {}) ⇒ Object
- #to_text_area_tag_with_html5_attributes(options = {}) ⇒ Object
Instance Method Details
#to_check_box_tag_with_html5_attributes(options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
104 105 106 107 108 109 |
# File 'lib/html5_validators/action_view/form_helpers.rb', line 104 def to_check_box_tag_with_html5_attributes( = {}, checked_value = "1", unchecked_value = "0") if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false) ["required"] ||= object.class.attribute_required?(method_name) end to_check_box_tag_without_html5_attributes , checked_value, unchecked_value end |
#to_input_field_tag_with_html5_attributes(field_type, options = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/html5_validators/action_view/form_helpers.rb', line 76 def to_input_field_tag_with_html5_attributes(field_type, = {}) if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false) ["required"] ||= object.class.attribute_required?(method_name) ["maxlength"] ||= object.class.attribute_maxlength(method_name) ["max"] ||= object.class.attribute_max(method_name) ["min"] ||= object.class.attribute_min(method_name) end to_input_field_tag_without_html5_attributes field_type, end |
#to_radio_button_tag_with_html5_attributes(tag_value, options = {}) ⇒ Object
96 97 98 99 100 101 |
# File 'lib/html5_validators/action_view/form_helpers.rb', line 96 def (tag_value, = {}) if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false) ["required"] ||= object.class.attribute_required?(method_name) end tag_value, end |
#to_text_area_tag_with_html5_attributes(options = {}) ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/html5_validators/action_view/form_helpers.rb', line 87 def to_text_area_tag_with_html5_attributes( = {}) if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false) ["required"] ||= object.class.attribute_required?(method_name) ["maxlength"] ||= object.class.attribute_maxlength(method_name) end to_text_area_tag_without_html5_attributes end |