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

26 lines
505 B
Ruby
Raw Normal View History

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