diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-09-05 12:32:17 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-09-05 12:32:17 +0100 |
commit | 7f0ae82d44873b53cc87c659b42415ce4866c7b4 (patch) | |
tree | fdce14b0658bb05aef087dd4e09dc25c9a79ea8c /app/controllers/request_controller.rb | |
parent | 2926ee877bcf8974c529e1271ded42971fe0d632 (diff) | |
parent | 96c4dd912083edcd0c9eda76bd2301bb4a1a6d53 (diff) |
Merge branch 'develop' of github.com:sebbacon/alaveteli into develop, fix conflicts
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 10c0917c8..12b5247b5 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -22,6 +22,21 @@ class RequestController < ApplicationController rescue MissingSourceFile, NameError end + def select_authority + # Check whether we force the user to sign in right at the start, or we allow her + # to start filling the request anonymously + if force_registration_on_new_request && !authenticated?( + :web => _("To send your FOI request"), + :email => _("Then you'll be allowed to send FOI requests."), + :email_subject => _("Confirm your email address") + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + + medium_cache + end + def show medium_cache @locale = self.locale_from_params() @@ -66,7 +81,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 @@ -131,7 +146,7 @@ class RequestController < ApplicationController @view = params[:view] params[:latest_status] = @view query = make_query_from_params - @title = "View and search requests" + @title = _("View and search requests") sortby = "newest" @page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect behavior_cache :tag => [@view, @page] do @@ -727,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 |