From f59700138f7360436767fddea554c739e2cd484b Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 25 Sep 2012 08:55:35 +1000 Subject: Extract configuration with defaults into one module --- app/controllers/general_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 839064fcd..9e47af22a 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -24,7 +24,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] @@ -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 -- cgit v1.2.3 From a603b89eaee5ed22e7857d54fecd82c938763ac4 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 26 Sep 2012 11:22:50 +0100 Subject: Use new info_requests_count counter cache column on public body when generating front page. --- app/controllers/general_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 839064fcd..5a7b006a0 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -32,8 +32,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 -- cgit v1.2.3 From 287c7f3944fb35ba939a74da368d6b8f973454aa Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Sat, 29 Sep 2012 10:04:09 +1000 Subject: When the list of requests on the frontpage is being filled out with not just successful requests make the text and the link reflect that --- app/controllers/general_controller.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 5a7b006a0..dc8e03d7a 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -55,10 +55,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 = [] -- cgit v1.2.3 From 28ae5eb5595b41e06da5d74a6670b806364ef23a Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 9 Oct 2012 11:38:23 +1100 Subject: Remove svn tags that are out of date as we are now using git --- app/controllers/general_controller.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 03b988505..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' -- cgit v1.2.3