aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/search_field.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/helpers/tags/search_field.rb')
-rw-r--r--actionview/lib/action_view/helpers/tags/search_field.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/tags/search_field.rb b/actionview/lib/action_view/helpers/tags/search_field.rb
new file mode 100644
index 0000000000..a848aeabfa
--- /dev/null
+++ b/actionview/lib/action_view/helpers/tags/search_field.rb
@@ -0,0 +1,25 @@
+module ActionView
+ module Helpers
+ module Tags # :nodoc:
+ class SearchField < TextField # :nodoc:
+ def render
+ options = @options.stringify_keys
+
+ if options["autosave"]
+ if options["autosave"] == true
+ options["autosave"] = request.host.split(".").reverse.join(".")
+ end
+ options["results"] ||= 10
+ end
+
+ if options["onsearch"]
+ options["incremental"] = true unless options.has_key?("incremental")
+ end
+
+ @options = options
+ super
+ end
+ end
+ end
+ end
+end