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