diff options
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index dff03983b..fac57c7e0 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -22,6 +22,10 @@ class RequestController < ApplicationController rescue MissingSourceFile, NameError end + def select_authority + medium_cache + end + def show medium_cache @locale = self.locale_from_params() @@ -66,7 +70,7 @@ class RequestController < ApplicationController @last_info_request_event_id = @info_request.last_event_id_needing_description @new_responses_count = @info_request.events_needing_description.select {|i| i.event_type == 'response'}.size -1 + # Sidebar stuff # ... requests that have similar imporant terms behavior_cache :tag => ['similar', @info_request.id] do @@ -272,6 +276,15 @@ class RequestController < ApplicationController return end + if !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), + :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + # Show preview page, if it is a preview if params[:preview].to_i == 1 message = "" @@ -294,15 +307,6 @@ class RequestController < ApplicationController return end - if !authenticated?( - :web => _("To send your FOI request"), - :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), - :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name - ) - # do nothing - as "authenticated?" has done the redirect to signin page for us - return - end - @info_request.user = authenticated_user # This automatically saves dependent objects, such as @outgoing_message, in the same transaction @info_request.save! @@ -738,5 +742,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 |