2010-02-06 16:21:26 -05:00
|
|
|
module SimpleForm
|
|
|
|
module Inputs
|
|
|
|
class StringInput < Base
|
2011-12-04 07:40:00 -05:00
|
|
|
enable :placeholder, :maxlength, :pattern
|
2011-12-04 07:29:59 -05:00
|
|
|
|
2010-02-06 16:21:26 -05:00
|
|
|
def input
|
2011-12-04 09:56:05 -05:00
|
|
|
unless string?
|
|
|
|
input_html_classes.unshift("string")
|
2011-12-04 10:15:27 -05:00
|
|
|
input_html_options[:type] ||= input_type if html5?
|
2011-12-04 09:56:05 -05:00
|
|
|
end
|
|
|
|
|
2011-09-03 06:00:23 -04:00
|
|
|
add_size!
|
2011-09-03 05:02:58 -04:00
|
|
|
@builder.text_field(attribute_name, input_html_options)
|
2010-02-06 16:21:26 -05:00
|
|
|
end
|
|
|
|
|
2011-09-03 06:00:23 -04:00
|
|
|
private
|
2010-02-06 16:21:26 -05:00
|
|
|
|
2010-11-21 10:50:36 -05:00
|
|
|
def string?
|
|
|
|
input_type == :string
|
|
|
|
end
|
2010-02-06 16:21:26 -05:00
|
|
|
end
|
|
|
|
end
|
2010-03-05 18:39:42 -05:00
|
|
|
end
|