mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
29 lines
612 B
Ruby
29 lines
612 B
Ruby
module SimpleForm
|
|
module Components
|
|
module HTML5
|
|
def initialize(*)
|
|
@html5 = false
|
|
end
|
|
|
|
def html5
|
|
@html5 = true
|
|
if has_required?
|
|
input_html_options[:required] = true
|
|
input_html_options[:'aria-required'] = true
|
|
end
|
|
nil
|
|
end
|
|
|
|
def html5?
|
|
@html5
|
|
end
|
|
|
|
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
|
|
end
|
|
end
|
|
end
|