heartcombo--simple_form/lib/simple_form/inputs/boolean_input.rb

29 lines
711 B
Ruby
Raw Normal View History

module SimpleForm
module Inputs
class BooleanInput < Base
def input
@builder.check_box(attribute_name, input_html_options)
end
def label_input
if options[:label] == false
input
elsif nested_boolean_style?
@builder.label(label_target, label_html_options) { input + label_text }
else
input + label
end
end
private
# Booleans are not required by default because in most of the cases
# it makes no sense marking them as required. The only exception is
# Terms of Use usually presented at most sites sign up screen.
2011-12-04 12:00:39 +00:00
def required_by_default?
false
end
end
end
end