From 2dd460cb432460fc32178140e3b4d6c31b55e883 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Mon, 8 Aug 2011 13:22:47 +0200 Subject: I18n'd hardcoded WhatDoTheyKnow strings, mostly in mails. Use named variable substitution in gettext strings. --- app/controllers/request_controller.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index e446854ab..dff03983b 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -398,24 +398,26 @@ class RequestController < ApplicationController elsif @info_request.calculate_status == 'not_held' flash[:notice] = _("

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

- ") % ["/new",CGI.escapeHTML(unhappy_url(@info_request)),CGI.escapeHTML(unhappy_url(@info_request)) + "#other_means"] + ", + :find_authority_url => "/new", + :complain_url => CGI.escapeHTML(unhappy_url(@info_request)), + :other_means_url => CGI.escapeHTML(unhappy_url(@info_request)) + "#other_means") redirect_to request_url(@info_request) elsif @info_request.calculate_status == 'rejected' flash[:notice] = _("Oh no! Sorry to hear that your request was refused. Here is what to do now.") redirect_to unhappy_url(@info_request) elsif @info_request.calculate_status == 'successful' - flash[:notice] = _("

We're glad you got all the information that you wanted. If you write about or make use of the information, please come back and add an annotation below saying what you did.

If you found WhatDoTheyKnow useful, make a donation to the charity which runs it.

") % ["http://www.mysociety.org/donate/"] + flash[:notice] = _("

We're glad you got all the information that you wanted. If you write about or make use of the information, please come back and add an annotation below saying what you did.

If you found {{site_name}} useful, make a donation to the charity which runs it.

", :site_name=>site_name, :donation_url => "http://www.mysociety.org/donate/") redirect_to request_url(@info_request) elsif @info_request.calculate_status == 'partially_successful' - flash[:notice] = _("

We're glad you got some of the information that you wanted. If you found WhatDoTheyKnow useful, make a donation to the charity which runs it.

If you want to try and get the rest of the information, here's what to do now.

") % ["http://www.mysociety.org/donate/"] + flash[:notice] = _("

We're glad you got some of the information that you wanted. If you found {{site_name}} useful, make a donation to the charity which runs it.

If you want to try and get the rest of the information, here's what to do now.

", :site_name=>site_name, :donation_url=>"http://www.mysociety.org/donate/") redirect_to unhappy_url(@info_request) elsif @info_request.calculate_status == 'waiting_clarification' flash[:notice] = _("Please write your follow up message containing the necessary clarifications below.") @@ -423,7 +425,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 20 days, or be told if it will take longer (details).

") % [unhappy_url(@info_request) + "#internal_review"] + flash[:notice] = _("

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

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

", :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.

") -- cgit v1.2.3 From fd3763c2a20af24428307a0dd1936d927ed323e2 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 12 Aug 2011 16:24:23 +0100 Subject: When displaying information about how overdue something is, use values from the config file, rather than hard coded ones. Fixes #130. --- 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 dff03983b..42d54a403 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -393,7 +393,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 40 working days. Most requests should be answered within 20 working days. You might like to complain about this, see below.

") + 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)) 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:

-- cgit v1.2.3 From 7c7d7187b682f926e39231bcc748b0694d594445 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 17 Aug 2011 10:52:15 +0100 Subject: Add test for generation of HTML versions of attachments. As a side-effect, make some of the HTML more valid. Prerequisite for addressing issue #108. --- app/controllers/request_controller.rb | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 42d54a403..466c6d6ce 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -604,23 +604,29 @@ class RequestController < ApplicationController # special caching code so mime types are handled right around_filter :cache_attachments, :only => [ :get_attachment, :get_attachment_as_html ] def cache_attachments - key = params.merge(:only_path => true) - key_path = foi_fragment_cache_path(key) + if !params[:skip_cache].nil? + yield + else + key = params.merge(:only_path => true) + key_path = foi_fragment_cache_path(key) - if foi_fragment_cache_exists?(key_path) - cached = foi_fragment_cache_read(key_path) - response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream' - render_for_text(cached) - return - end + if foi_fragment_cache_exists?(key_path) + cached = foi_fragment_cache_read(key_path) + response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream' + render_for_text(cached) + return + end - yield + yield - # write it to the fileystem ourselves, so is just a plain file. (The - # various fragment cache functions using Ruby Marshall to write the file - # which adds a header, so isnt compatible with images that have been - # extracted elsewhere from PDFs) - foi_fragment_cache_write(key_path, response.body) + if params[:skip_cache].nil? + # write it to the fileystem ourselves, so is just a plain file. (The + # various fragment cache functions using Ruby Marshall to write the file + # which adds a header, so isnt compatible with images that have been + # extracted elsewhere from PDFs) + foi_fragment_cache_write(key_path, response.body) + end + end end def get_attachment @@ -649,7 +655,7 @@ class RequestController < ApplicationController view_html_stylesheet = render_to_string :partial => "request/view_html_stylesheet" html.sub!(//i, "" + view_html_stylesheet) - html.sub!(/]*>/i, '
') + html.sub!(/]*>/i, '
') html.sub!(/<\/body[^>]*>/i, '
') view_html_prefix = render_to_string :partial => "request/view_html_prefix" @@ -657,7 +663,6 @@ class RequestController < ApplicationController html.sub!("", CGI.escape(@attachment_url)) @incoming_message.html_mask_stuff!(html) - response.content_type = 'text/html' render :text => html end -- cgit v1.2.3 From c154b6a4ff5ab7b5a7d667e68b3b426875676853 Mon Sep 17 00:00:00 2001 From: Faton Selishta Date: Mon, 22 Aug 2011 10:33:17 +0200 Subject: changed hard coded information about how overdue --- 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 466c6d6ce..426996f2e 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -425,7 +425,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 20 days, or be told if it will take longer (details).

", :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 => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20)), :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.

") -- cgit v1.2.3 From c2aa5f55f14528c4e8fca0aff887d43d9e098a40 Mon Sep 17 00:00:00 2001 From: Faton Selishta Date: Mon, 22 Aug 2011 11:02:44 +0200 Subject: Rebuild .pot file after I18n changes and fix syntax at request_controller --- 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 426996f2e..c1a13273a 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -425,7 +425,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 => MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20), :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.

") -- cgit v1.2.3