File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,6 +229,7 @@ def supports_js_redirection?
229229 end
230230
231231 get '/' do
232+ return redirect "/#q=#{ params [ :q ] } " if params [ :q ]
232233 return redirect '/' unless request . query_string . empty? # courtesy of HTML5 App Cache
233234 response . headers [ 'Content-Security-Policy' ] = settings . csp if settings . csp
234235 erb :index
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ def app
1717 assert last_response . ok?
1818 end
1919
20+ it "redirects to /#q= when there is a 'q' query param" do
21+ get '/search' , q : 'foo'
22+ assert last_response . redirect?
23+ assert_equal 'http://example.org/#q=foo' , last_response [ 'Location' ]
24+ end
25+
2026 it "redirects without the query string" do
2127 get '/' , foo : 'bar'
2228 assert last_response . redirect?
Original file line number Diff line number Diff line change 55 < button type ="button " class ="_mobile-btn _menu-btn "> Menu</ button >
66 < button type ="button " class ="_mobile-btn _home-btn "> Home</ button >
77 < form class ="_search " role ="search ">
8- < input type ="search " class ="_search-input " placeholder ="Search… " autocomplete ="off " autocapitalize ="off " autocorrect ="off " spellcheck ="false " maxlength ="30 " aria-label ="Search ">
8+ < input type ="search " name =" q " class ="_search-input " placeholder ="Search… " autocomplete ="off " autocapitalize ="off " autocorrect ="off " spellcheck ="false " maxlength ="30 " aria-label ="Search ">
99 < button type ="reset " class ="_search-clear " title ="Clear search "> Clear search</ button >
1010 < div class ="_search-tag "> </ div >
1111 </ form >
You can’t perform that action at this time.
0 commit comments