Permalink
Browse files

Added prepared search terms

  • Loading branch information...
1 parent 1d8ceb2 commit f5651cc3297f302bb3a62f6ba4a96583e8629578 @accuser accuser committed Mar 5, 2011
Showing with 16 additions and 2 deletions.
  1. +11 −0 app/helpers/application_helper.rb
  2. +5 −2 app/views/errors/not_found.html.haml
@@ -12,4 +12,15 @@ def copyright_period
%Q(2009)
end
end
+
+ def searchify(s)
+ s = s.to_s.mb_chars.normalize(:kd)
+
+ s.gsub!(/[^\w -]+/n, '') # strip unwanted characters
+ s.strip!
+ s.downcase!
+ s.gsub!(/[ -]+/, ' ')
+
+ s
+ end
end
@@ -2,5 +2,8 @@
%h1 Don't Panic
%p
The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
-- form_tag(search_index_path, :method => :get) do
- = text_field_tag :q, 'Search', :onclick => 'if(this.value=="Search"){this.value=""}', :onblur => 'if(this.value==""){this.value="Search"}'
+%h2 Other things to try:
+%p
+ Search <em>clahrc.net</em>:
+ - form_tag(search_index_path, :method => :get) do
+ = text_field_tag :q, 'Search', :value => searchify(request.path)

0 comments on commit f5651cc

Please sign in to comment.