aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/body_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/body_controller.rb')
-rw-r--r--app/controllers/body_controller.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb
index 7a07daf39..e8e0780cd 100644
--- a/app/controllers/body_controller.rb
+++ b/app/controllers/body_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: body_controller.rb,v 1.19 2008-10-17 11:37:59 francis Exp $
+# $Id: body_controller.rb,v 1.20 2009-03-18 02:37:42 francis Exp $
class BodyController < ApplicationController
# XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL
@@ -33,6 +33,19 @@ class BodyController < ApplicationController
@public_body = @public_bodies[0]
set_last_body(@public_body)
+ # Use search query for this so can collapse and paginate easily
+ # XXX really should just use SQL query here rather than Xapian.
+ begin
+ @xapian_requests = perform_search([InfoRequestEvent], 'requested_from:' + @public_body.url_name, 'newest', 'request_collapse')
+ if (@page > 1)
+ @page_desc = " (page " + @page.to_s + ")"
+ else
+ @page_desc = ""
+ end
+ rescue
+ @xapian_requests = nil
+ end
+
@track_thing = TrackThing.create_track_for_public_body(@public_body)
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ]
end