aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-07-26 22:07:30 +0200
committerDavid Cabo <david@calibea.com>2011-07-26 22:07:30 +0200
commit9925d8f83864dc740d9b284a9e472d422dba12fb (patch)
treeb8116a4f12140912b76440211bc9674007f9286a /app/controllers/request_controller.rb
parent058a65ae0d079729b10a2954c472c336dce43245 (diff)
Adapting New Request flow to new wireframes: added type ahead search when creating new requests
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 472f18f6e..b6111b087 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -736,5 +736,17 @@ class RequestController < ApplicationController
return
end
end
+
+ # Type ahead search
+ def search_typeahead
+ # Since acts_as_xapian doesn't support the Partial match flag, we work around it
+ # by making the last work a wildcard, which is quite the same
+ query = params[:q] + '*'
+
+ query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND!
+ @xapian_requests = perform_search([InfoRequestEvent], query, 'relevant', 'request_collapse', 5)
+
+ render :partial => "request/search_ahead.rhtml"
+ end
end