diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-01-08 14:09:41 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-01-13 17:22:11 +0000 |
commit | 1488f24e3f03fe46b222fa2fca4ae273d0b46ebf (patch) | |
tree | 5ba51d3842064945cd9c49fed9b7b83a8f158a09 /app/controllers/request_controller.rb | |
parent | 5fb5ec9b8d303d1f5766ecdbbd01e1093ba744dd (diff) |
Add a “Back to search results” link
Store the search parameters in the flash when a search is made via the
select_authority_path page. Stores the parameters for both POST and
AJAX typeahead searches.
The presence of stored search params renders the link on the
PublicBodyController#show template.
“keep”s the search params in PublicBodyController#show so that if the
user clicks the browser’s back button the “Back to search results” link
can still be rendered on the next search result they click.
“keep”s all flash keys in ServicesController#other_country_message
as it’s called through AJAX and ends up sweeping the flash. [1]
[1] More details about this:
http://mikenaberezny.com/2007/09/08/keep-the-flash-and-test-it-too/
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 39e7616ed..f1076f0bc 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -37,6 +37,7 @@ class RequestController < ApplicationController end if !params[:query].nil? query = params[:query] + flash[:search_params] = params.slice(:query, :bodies, :page) @xapian_requests = perform_search_typeahead(query, PublicBody) end medium_cache @@ -123,7 +124,6 @@ class RequestController < ApplicationController @track_thing = TrackThing.create_track_for_request(@info_request) @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] - respond_to do |format| format.html { @has_json = true; render :template => 'request/show'} format.json { render :json => @info_request.json_for_api(true) } |