2010-02-06 21:21:26 +00:00
|
|
|
module SimpleForm
|
|
|
|
module Inputs
|
|
|
|
class StringInput < Base
|
2011-12-04 12:40:00 +00:00
|
|
|
enable :placeholder, :maxlength, :pattern
|
2011-12-04 12:29:59 +00:00
|
|
|
|
2014-03-11 22:41:25 +00:00
|
|
|
def input(wrapper_options = nil)
|
2011-12-04 14:56:05 +00:00
|
|
|
unless string?
|
|
|
|
input_html_classes.unshift("string")
|
2011-12-04 15:15:27 +00:00
|
|
|
input_html_options[:type] ||= input_type if html5?
|
2011-12-04 14:56:05 +00:00
|
|
|
end
|
|
|
|
|
2014-03-11 22:41:25 +00:00
|
|
|
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
2014-03-11 13:30:49 +00:00
|
|
|
|
|
|
|
@builder.text_field(attribute_name, merged_input_options)
|
2010-02-06 21:21:26 +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
|