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/request_controller.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 268ecc73a..9ad328a0c 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -46,7 +46,7 @@ class RequestController < ApplicationController end def show - if !MySociety::Config.get('VARNISH_HOST').nil? + if !Configuration::varnish_host.nil? # If varnish is set up to accept PURGEs, then cache for a # long time long_cache @@ -369,7 +369,7 @@ class RequestController < ApplicationController replied by then.

If you write about this request (for example in a forum or a blog) please link to this page, and add an annotation below telling people about your writing.

",:law_used_full=>@info_request.law_used_full, - :late_number_of_days => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20)) + :late_number_of_days => Configuration::reply_late_after_days) redirect_to show_new_request_path(:url_title => @info_request.url_title) end @@ -457,7 +457,7 @@ class RequestController < ApplicationController flash[:notice] = _("

Thank you! Hope you don't have to wait much longer.

By law, you should have got a response promptly, and normally before the end of {{date_response_required_by}}.

",:date_response_required_by=>simple_date(@info_request.date_response_required_by)) redirect_to request_url(@info_request) elsif @info_request.calculate_status == 'waiting_response_very_overdue' - flash[:notice] = _("

Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.

", :very_late_number_of_days => MySociety::Config.get('REPLY_VERY_LATE_AFTER_DAYS', 40), :late_number_of_days => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20)) + flash[:notice] = _("

Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.

", :very_late_number_of_days => Configuration::reply_very_late_after_days, :late_number_of_days => Configuration::reply_late_after_days) redirect_to unhappy_url(@info_request) elsif @info_request.calculate_status == 'not_held' flash[:notice] = _("

Thank you! Here are some ideas on what to do next:

@@ -489,7 +489,7 @@ class RequestController < ApplicationController elsif @info_request.calculate_status == 'gone_postal' redirect_to respond_to_last_url(@info_request) + "?gone_postal=1" elsif @info_request.calculate_status == 'internal_review' - flash[:notice] = _("

Thank you! Hopefully your wait isn't too long.

You should get a response within {{late_number_of_days}} days, or be told if it will take longer (details).

",:late_number_of_days => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20), :review_url => unhappy_url(@info_request) + "#internal_review") + flash[:notice] = _("

Thank you! Hopefully your wait isn't too long.

You should get a response within {{late_number_of_days}} days, or be told if it will take longer (details).

",:late_number_of_days => Configuration.reply_late_after_days, :review_url => unhappy_url(@info_request) + "#internal_review") redirect_to request_url(@info_request) elsif @info_request.calculate_status == 'error_message' flash[:notice] = _("

Thank you! We'll look into what happened and try and fix it up.

If the error was a delivery failure, and you can find an up to date FOI email address for the authority, please tell us using the form below.

") @@ -875,11 +875,10 @@ class RequestController < ApplicationController if !File.exists?(file_path) FileUtils.mkdir_p(File.dirname(file_path)) Zip::ZipFile.open(file_path, Zip::ZipFile::CREATE) { |zipfile| - convert_command = MySociety::Config.get("HTML_TO_PDF_COMMAND") + convert_command = Configuration::html_to_pdf_command done = false if File.exists?(convert_command) - domain = MySociety::Config.get("DOMAIN") - url = "http://#{domain}#{request_url(info_request)}?print_stylesheet=1" + url = "http://#{Configuration::domain}#{request_url(info_request)}?print_stylesheet=1" tempfile = Tempfile.new('foihtml2pdf') output = AlaveteliExternalCommand.run(convert_command, url, tempfile.path) if !output.nil? -- cgit v1.2.3 From 6ee1e8d0a4a8cfe02797c1a853bf27af2610ad27 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 25 Sep 2012 09:15:47 +1000 Subject: Inline ConfigHelper force_registration_on_new_request --- app/controllers/request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 9ad328a0c..07d188079 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -30,7 +30,7 @@ class RequestController < ApplicationController def select_authority # Check whether we force the user to sign in right at the start, or we allow her # to start filling the request anonymously - if force_registration_on_new_request && !authenticated?( + if Configuration::force_registration_on_new_request && !authenticated?( :web => _("To send your FOI request"), :email => _("Then you'll be allowed to send FOI requests."), :email_subject => _("Confirm your email address") -- 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/request_controller.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 07d188079..396e6593a 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -3,8 +3,6 @@ # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: request_controller.rb,v 1.192 2009-10-19 19:26:40 francis Exp $ require 'alaveteli_file_types' require 'zip/zip' -- cgit v1.2.3