From 4b83519e02d5d42708dd1770f965b122a11c4440 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 13 Feb 2013 16:58:33 +1100 Subject: Rename helper method --- 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 dfa3a4834..0dec1fb72 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -279,7 +279,7 @@ class RequestController < ApplicationController else # if not requestable because defunct or not_apply, redirect to main page # (which doesn't link to the /new/ URL) - redirect_to public_body_url(@info_request.public_body) + redirect_to public_body_path(@info_request.public_body) end end return -- cgit v1.2.3 From 85223bb2b630c8576352816b47b3c93f5c0b593b Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 13 Feb 2013 17:05:39 +1100 Subject: Redirects should be done with absolute urls --- 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 0dec1fb72..dfa3a4834 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -279,7 +279,7 @@ class RequestController < ApplicationController else # if not requestable because defunct or not_apply, redirect to main page # (which doesn't link to the /new/ URL) - redirect_to public_body_path(@info_request.public_body) + redirect_to public_body_url(@info_request.public_body) end end return -- cgit v1.2.3 From ba15c9b78dca182f74281d7354e77942860259e7 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 13 Feb 2013 19:15:51 +1100 Subject: Rename helper method --- app/controllers/request_controller.rb | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index dfa3a4834..0dd54b503 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -57,7 +57,7 @@ class RequestController < ApplicationController # Look up by old style numeric identifiers if params[:url_title].match(/^[0-9]+$/) @info_request = InfoRequest.find(params[:url_title].to_i) - redirect_to request_url(@info_request, :format => params[:format]) + redirect_to request_path(@info_request, :format => params[:format]) return end @@ -380,14 +380,14 @@ class RequestController < ApplicationController # If this isn't a form submit, go to the request page if params[:submitted_describe_state].nil? - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) return end # If this is an external request, go to the request page - we don't allow # state change from the front end interface. if @info_request.is_external? - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) return end @@ -408,13 +408,13 @@ class RequestController < ApplicationController if !params[:incoming_message] flash[:error] = _("Please choose whether or not you got some of the information that you wanted.") - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) return end if params[:last_info_request_event_id].to_i != @last_info_request_event_id flash[:error] = _("The request has been updated since you originally loaded this page. Please check for any new incoming messages below, and try again.") - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) return end @@ -439,11 +439,11 @@ class RequestController < ApplicationController # Don't give advice on what to do next, as it isn't their request RequestMailer.deliver_old_unclassified_updated(@info_request) if !@info_request.is_external? if session[:request_game] - flash[:notice] = _('Thank you for updating the status of the request \'{{info_request_title}}\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_url(@info_request))) + flash[:notice] = _('Thank you for updating the status of the request \'{{info_request_title}}\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_path(@info_request))) redirect_to play_url else flash[:notice] = _('Thank you for updating this request!') - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) end return end @@ -453,10 +453,10 @@ class RequestController < ApplicationController if calculated_status == 'waiting_response' flash[:notice] = _("

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

By law, you should get 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) + redirect_to request_path(@info_request) elsif calculated_status == 'waiting_response_overdue' 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) + redirect_to request_path(@info_request) elsif calculated_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 => Configuration::reply_very_late_after_days, :late_number_of_days => Configuration::reply_late_after_days) redirect_to unhappy_url(@info_request) @@ -474,13 +474,13 @@ class RequestController < ApplicationController :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) + redirect_to request_path(@info_request) elsif calculated_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 calculated_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 {{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) + redirect_to request_path(@info_request) elsif calculated_status == 'partially_successful' 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) @@ -491,7 +491,7 @@ class RequestController < ApplicationController redirect_to respond_to_last_url(@info_request) + "?gone_postal=1" elsif calculated_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 => Configuration.reply_late_after_days, :review_url => unhappy_url(@info_request) + "#internal_review") - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) elsif calculated_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.

") redirect_to help_general_url(:action => 'contact') @@ -520,7 +520,7 @@ class RequestController < ApplicationController redirect_to outgoing_message_url(@info_request_event.outgoing_message), :status => :moved_permanently else # XXX maybe there are better URLs for some events than this - redirect_to request_url(@info_request_event.info_request), :status => :moved_permanently + redirect_to request_path(@info_request_event.info_request), :status => :moved_permanently end end @@ -655,7 +655,7 @@ class RequestController < ApplicationController else flash[:notice] = _("Your follow up message has been sent on its way.") end - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) end else # render default show_response template @@ -696,7 +696,7 @@ class RequestController < ApplicationController else flash[:notice] = _("This request has already been reported for administrator attention") end - redirect_to request_url(info_request) + redirect_to request_path(info_request) end # special caching code so mime types are handled right @@ -853,7 +853,7 @@ class RequestController < ApplicationController mail = RequestMailer.create_fake_response(@info_request, @user, body, file_name, file_content) @info_request.receive(mail, mail.encoded, true) flash[:notice] = _("Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to ") + CGI.escapeHTML(@info_request.user.name) + "." - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) return end end @@ -895,7 +895,7 @@ class RequestController < ApplicationController convert_command = Configuration::html_to_pdf_command done = false if !convert_command.blank? && File.exists?(convert_command) - url = "http://#{Configuration::domain}#{request_url(@info_request)}?print_stylesheet=1" + url = "http://#{Configuration::domain}#{request_path(@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 5dce6d1465efa82a33a07706363221b39e8ca029 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 13 Feb 2013 19:32:50 +1100 Subject: Redirects should be done with absolute urls --- app/controllers/request_controller.rb | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 0dd54b503..163c64bc4 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -57,7 +57,7 @@ class RequestController < ApplicationController # Look up by old style numeric identifiers if params[:url_title].match(/^[0-9]+$/) @info_request = InfoRequest.find(params[:url_title].to_i) - redirect_to request_path(@info_request, :format => params[:format]) + redirect_to request_url(@info_request, :format => params[:format]) return end @@ -380,14 +380,14 @@ class RequestController < ApplicationController # If this isn't a form submit, go to the request page if params[:submitted_describe_state].nil? - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) return end # If this is an external request, go to the request page - we don't allow # state change from the front end interface. if @info_request.is_external? - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) return end @@ -408,13 +408,13 @@ class RequestController < ApplicationController if !params[:incoming_message] flash[:error] = _("Please choose whether or not you got some of the information that you wanted.") - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) return end if params[:last_info_request_event_id].to_i != @last_info_request_event_id flash[:error] = _("The request has been updated since you originally loaded this page. Please check for any new incoming messages below, and try again.") - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) return end @@ -443,7 +443,7 @@ class RequestController < ApplicationController redirect_to play_url else flash[:notice] = _('Thank you for updating this request!') - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) end return end @@ -453,10 +453,10 @@ class RequestController < ApplicationController if calculated_status == 'waiting_response' flash[:notice] = _("

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

By law, you should get 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_path(@info_request) + redirect_to request_url(@info_request) elsif calculated_status == 'waiting_response_overdue' 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_path(@info_request) + redirect_to request_url(@info_request) elsif calculated_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 => Configuration::reply_very_late_after_days, :late_number_of_days => Configuration::reply_late_after_days) redirect_to unhappy_url(@info_request) @@ -474,13 +474,13 @@ class RequestController < ApplicationController :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_path(@info_request) + redirect_to request_url(@info_request) elsif calculated_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 calculated_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 {{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_path(@info_request) + redirect_to request_url(@info_request) elsif calculated_status == 'partially_successful' 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) @@ -491,7 +491,7 @@ class RequestController < ApplicationController redirect_to respond_to_last_url(@info_request) + "?gone_postal=1" elsif calculated_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 => Configuration.reply_late_after_days, :review_url => unhappy_url(@info_request) + "#internal_review") - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) elsif calculated_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.

") redirect_to help_general_url(:action => 'contact') @@ -520,7 +520,7 @@ class RequestController < ApplicationController redirect_to outgoing_message_url(@info_request_event.outgoing_message), :status => :moved_permanently else # XXX maybe there are better URLs for some events than this - redirect_to request_path(@info_request_event.info_request), :status => :moved_permanently + redirect_to request_url(@info_request_event.info_request), :status => :moved_permanently end end @@ -655,7 +655,7 @@ class RequestController < ApplicationController else flash[:notice] = _("Your follow up message has been sent on its way.") end - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) end else # render default show_response template @@ -696,7 +696,7 @@ class RequestController < ApplicationController else flash[:notice] = _("This request has already been reported for administrator attention") end - redirect_to request_path(info_request) + redirect_to request_url(info_request) end # special caching code so mime types are handled right @@ -853,7 +853,7 @@ class RequestController < ApplicationController mail = RequestMailer.create_fake_response(@info_request, @user, body, file_name, file_content) @info_request.receive(mail, mail.encoded, true) flash[:notice] = _("Thank you for responding to this FOI request! Your response has been published below, and a link to your response has been emailed to ") + CGI.escapeHTML(@info_request.user.name) + "." - redirect_to request_path(@info_request) + redirect_to request_url(@info_request) return end end -- cgit v1.2.3 From 64fe099163e8b786e6c05fe05fe9cbb8c068e380 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 14 Feb 2013 04:32:11 +1100 Subject: Rename named routes for categorisation game as they clash with request_url & request_path helpers --- 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 163c64bc4..f8e865523 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -440,7 +440,7 @@ class RequestController < ApplicationController RequestMailer.deliver_old_unclassified_updated(@info_request) if !@info_request.is_external? if session[:request_game] flash[:notice] = _('Thank you for updating the status of the request \'{{info_request_title}}\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_path(@info_request))) - redirect_to play_url + redirect_to categorise_play_url else flash[:notice] = _('Thank you for updating this request!') redirect_to request_url(@info_request) -- cgit v1.2.3 From 4dd61c8235bb685b1d2b3041c4ab2cf912c04006 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 15 Feb 2013 14:50:02 +1100 Subject: Use absolute urls when redirecting --- app/controllers/request_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index f8e865523..3e18acd82 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -166,7 +166,7 @@ class RequestController < ApplicationController @view = params[:view] @page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect if @view == "recent" - return redirect_to request_list_all_path(:action => "list", :view => "all", :page => @page), :status => :moved_permanently + return redirect_to request_list_all_url(:action => "list", :view => "all", :page => @page), :status => :moved_permanently end # Later pages are very expensive to load @@ -370,7 +370,7 @@ class RequestController < ApplicationController

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 => Configuration::reply_late_after_days) - redirect_to show_new_request_path(:url_title => @info_request.url_title) + redirect_to show_new_request_url(:url_title => @info_request.url_title) end # Submitted to the describing state of messages form -- cgit v1.2.3