diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-08-24 11:50:10 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-08-24 11:50:10 +0100 |
commit | 6675866787bf2c9cb095b8154fbdae33a1fb71c4 (patch) | |
tree | c4cf9cc17bce2006e6e0e06f8945be783ae3d976 /app/controllers/request_controller.rb | |
parent | b9c7136580e65be4f0eb5c7ebbeaf42aeb888d1f (diff) |
First stab at filtering on the "View requests" page
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index c1a13273a..731348fbf 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -129,25 +129,12 @@ class RequestController < ApplicationController def list medium_cache @view = params[:view] - - if @view.nil? - redirect_to request_list_url(:view => 'successful') - return - end - - if @view == 'recent' - @title = _("Recently sent Freedom of Information requests") - query = "variety:sent"; - sortby = "newest" - @track_thing = TrackThing.create_track_for_all_new_requests - elsif @view == 'successful' - @title = _("Recently successful responses") - query = 'variety:response (status:successful OR status:partially_successful)' - sortby = "described" - @track_thing = TrackThing.create_track_for_all_successful_requests - else - raise "unknown request list view " + @view.to_s + if !@view.nil? + params[:request_status] = @view end + params[:request_status] = "recent" if params[:query].nil? && params[:request_status].nil? + query, sortby = alter_query_from_params(params[:query]) + @title = "Some title" @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 @@ -158,7 +145,8 @@ class RequestController < ApplicationController @title = @title + " (page " + @page.to_s + ")" if (@page > 1) - @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] + # XXX need to reinstate the following; @track_thing had previously been set to "TrackThing.create_track_for_all_new_requests" and "TrackThing.create_track_for_all_successful_requests" + # @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] # Don't let robots go more than 20 pages in if @page > 20 |