aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/general_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r--app/controllers/general_controller.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 839064fcd..150b433ec 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -4,8 +4,6 @@
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: general_controller.rb,v 1.57 2009-10-03 10:23:43 francis Exp $
begin
require 'xmlsimple'
@@ -24,7 +22,7 @@ class GeneralController < ApplicationController
behavior_cache :tag => [session[:user_id], request.url] do
# get some example searches and public bodies to display
# either from config, or based on a (slow!) query if not set
- body_short_names = MySociety::Config.get('FRONTPAGE_PUBLICBODY_EXAMPLES', '').split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ")
+ body_short_names = Configuration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ")
@locale = self.locale_from_params()
locale_condition = 'public_body_translations.locale = ?'
conditions = [locale_condition, @locale]
@@ -32,8 +30,7 @@ class GeneralController < ApplicationController
if body_short_names.empty?
# This is too slow
@popular_bodies = PublicBody.find(:all,
- :select => "public_bodies.*, (select count(*) from info_requests where info_requests.public_body_id = public_bodies.id) as c",
- :order => "c desc",
+ :order => "info_requests_count desc",
:limit => 32,
:conditions => conditions,
:joins => :translations
@@ -56,10 +53,13 @@ class GeneralController < ApplicationController
# If there are not yet enough successful requests, fill out the list with
# other requests
if @request_events.count < max_count
+ @request_events_all_successful = false
query = 'variety:sent'
xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_title_collapse', max_count-@request_events.count)
more_events = xapian_object.results.map { |r| r[:model] }
@request_events += more_events
+ else
+ @request_events_all_successful = true
end
rescue
@request_events = []
@@ -71,7 +71,7 @@ class GeneralController < ApplicationController
def blog
medium_cache
@feed_autodetect = []
- @feed_url = "#{MySociety::Config.get('BLOG_FEED', '')}?lang=#{self.locale_from_params()}"
+ @feed_url = "#{Configuration::blog_feed}?lang=#{self.locale_from_params()}"
@blog_items = []
if not @feed_url.empty?
content = quietly_try_to_open(@feed_url)
@@ -82,7 +82,7 @@ class GeneralController < ApplicationController
@feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}]
end
end
- @twitter_user = MySociety::Config.get('TWITTER_USERNAME', '')
+ @twitter_user = Configuration::twitter_username
end
# Just does a redirect from ?query= search to /query