Module: SimpleForm::Components::HTML5
- Included in:
- Inputs::Base
- Defined in:
- lib/simple_form/components/html5.rb
Instance Method Summary collapse
- #has_required? ⇒ Boolean
- #html5(wrapper_options = nil) ⇒ Object
- #html5? ⇒ Boolean
- #initialize ⇒ Object
- #input_html_aria_required_option ⇒ Object
- #input_html_required_option ⇒ Object
Instance Method Details
#has_required? ⇒ Boolean
31 32 33 34 35 36 |
# File 'lib/simple_form/components/html5.rb', line 31 def has_required? # We need to check browser_validations because # some browsers are still checking required even # if novalidate was given. required_field? && SimpleForm.browser_validations end |
#html5(wrapper_options = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/simple_form/components/html5.rb', line 8 def html5( = nil) @html5 = true [:required] = input_html_required_option [:'aria-required'] = input_html_aria_required_option [:'aria-invalid'] = has_errors? || nil nil end |
#html5? ⇒ Boolean
19 20 21 |
# File 'lib/simple_form/components/html5.rb', line 19 def html5? @html5 end |
#initialize ⇒ Object
4 5 6 |
# File 'lib/simple_form/components/html5.rb', line 4 def initialize(*) @html5 = false end |
#input_html_aria_required_option ⇒ Object
27 28 29 |
# File 'lib/simple_form/components/html5.rb', line 27 def input_html_aria_required_option ![:required].nil? ? (required_field? || nil) : (has_required? || nil) end |
#input_html_required_option ⇒ Object
23 24 25 |
# File 'lib/simple_form/components/html5.rb', line 23 def input_html_required_option ![:required].nil? ? required_field? : has_required? end |