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

25 lines
494 B
Ruby
Raw Normal View History

module SimpleForm
module Inputs
class StringInput < Base
enable :placeholder, :maxlength
def input
input_html_options[:type] ||= input_type if SimpleForm.html5 && !string?
add_pattern!
add_size!
2011-09-03 05:02:58 -04:00
@builder.text_field(attribute_name, input_html_options)
end
def input_html_classes
2010-11-21 10:50:36 -05:00
string? ? super : super.unshift("string")
end
private
2010-11-21 10:50:36 -05:00
def string?
input_type == :string
end
end
end
end