diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_request_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/api_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/comment_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/general_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 34 | ||||
-rw-r--r-- | app/controllers/services_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/track_controller.rb | 2 | ||||
-rwxr-xr-x | app/helpers/link_to_helper.rb | 12 | ||||
-rw-r--r-- | app/models/request_mailer.rb | 6 | ||||
-rw-r--r-- | app/views/admin_request/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/api/request_events.atom.builder | 2 | ||||
-rw-r--r-- | app/views/contact_mailer/to_admin_message.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/_frontpage_requests_list.rhtml | 2 | ||||
-rw-r--r-- | app/views/help/unhappy.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/_wall_listing.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 2 |
16 files changed, 39 insertions, 39 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index e39d55c7c..c631c88f9 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -42,7 +42,7 @@ class AdminRequestController < AdminController vars = OpenStruct.new(:name_to => @info_request.user_name, :name_from => Configuration::contact_name, :info_request => @info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(@info_request), + :info_request_url => 'http://' + Configuration::domain + request_path(@info_request), :site_name => site_name) template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.rhtml")) @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 0d6582773..aa1ea632f 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -220,7 +220,7 @@ class ApiController < ApplicationController :event_id => event.id, :created_at => event.created_at.iso8601, :event_type => event.event_type, - :request_url => main_url(request_url(request)), + :request_url => main_url(request_path(request)), :request_email => request.incoming_email, :title => request.title, :body => event.outgoing_message.body, diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index ed249d6cc..9b8e0f799 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -86,7 +86,7 @@ class CommentController < ApplicationController @info_request.save! # we don't use comment_url here, as then you don't see the flash at top of page - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) else # do nothing - as "authenticated?" has done the redirect to signin page for us end diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 875e39494..8aff5f7fc 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -221,7 +221,7 @@ class GeneralController < ApplicationController # Jump to a random request def random_request info_request = InfoRequest.random - redirect_to request_url(info_request) + redirect_to request_path(info_request) end def custom_css 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 \'<a href="{{url}}">{{info_request_title}}</a>\'. 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 \'<a href="{{url}}">{{info_request_title}}</a>\'. 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] = _("<p>Thank you! Hopefully your wait isn't too long.</p> <p>By law, you should get a response promptly, and normally before the end of <strong> {{date_response_required_by}}</strong>.</p>",: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] = _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",: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] = _("<p>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.</p>", :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] = _("<p>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.</p><p>If you found {{site_name}} useful, <a href=\"{{donation_url}}\">make a donation</a> to the charity which runs it.</p>", :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] = _("<p>We're glad you got some of the information that you wanted. If you found {{site_name}} useful, <a href=\"{{donation_url}}\">make a donation</a> to the charity which runs it.</p><p>If you want to try and get the rest of the information, here's what to do now.</p>", :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] = _("<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within {{late_number_of_days}} days, or be told if it will take longer (<a href=\"{{review_url}}\">details</a>).</p>",: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] = _("<p>Thank you! We'll look into what happened and try and fix it up.</p><p>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.</p>") 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? diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 1db5348c7..b21000bc4 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -38,7 +38,7 @@ class ServicesController < ApplicationController :locals => {:name_to => info_request.user_name, :name_from => Configuration::contact_name, :info_request => info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(info_request), + :info_request_url => 'http://' + Configuration::domain + request_path(info_request), :site_name => site_name} end diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 15da7f327..e2be3c7d0 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -19,7 +19,7 @@ class TrackController < ApplicationController return atom_feed_internal if params[:feed] == 'feed' if self.track_set - redirect_to request_url(@info_request) + redirect_to request_path(@info_request) end end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 07727a06a..aee67d93f 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -10,13 +10,13 @@ module LinkToHelper # Links to various models # Requests - def request_url(info_request, extra_params={}) + def request_path(info_request, extra_params={}) params = {:url_title => info_request.url_title, :only_path => true} return show_request_url(params.merge(extra_params)) end def request_link(info_request, cls=nil ) - link_to h(info_request.title), request_url(info_request), :class => cls + link_to h(info_request.title), request_path(info_request), :class => cls end def request_admin_url(info_request) @@ -28,7 +28,7 @@ module LinkToHelper end def request_both_links(info_request) - link_to(h(info_request.title), main_url(request_url(info_request))) + " (" + link_to("admin", request_admin_url(info_request)) + ")" + link_to(h(info_request.title), main_url(request_path(info_request))) + " (" + link_to("admin", request_admin_url(info_request)) + ")" end def request_similar_url(info_request) @@ -41,7 +41,7 @@ module LinkToHelper # Incoming / outgoing messages def incoming_message_url(incoming_message, options = {}) - return request_url(incoming_message.info_request, options.merge(:anchor => "incoming-#{incoming_message.id}")) + return request_path(incoming_message.info_request, options.merge(:anchor => "incoming-#{incoming_message.id}")) end def incoming_message_path(incoming_message) @@ -49,7 +49,7 @@ module LinkToHelper end def outgoing_message_url(outgoing_message, options = {}) - return request_url(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}")) + return request_path(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}")) end def outgoing_message_path(outgoing_message) @@ -57,7 +57,7 @@ module LinkToHelper end def comment_url(comment, options = {}) - return request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}")) + return request_path(comment.info_request, options.merge(:anchor => "comment-#{comment.id}")) end def comment_path(comment) diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 493d6961c..f42c3b0c7 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -67,7 +67,7 @@ class RequestMailer < ApplicationMailer @from = user.name_and_email @recipients = contact_from_name_and_email @subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title) - url = main_url(request_url(info_request)) + url = main_url(request_path(info_request)) admin_url = request_admin_url(info_request) @body = {:reported_by => user, :info_request => info_request, :url => url, :admin_url => admin_url } end @@ -131,7 +131,7 @@ class RequestMailer < ApplicationMailer # Make a link going to the form to describe state, and which logs the # user in. post_redirect = PostRedirect.new( - :uri => main_url(request_url(info_request)) + "#describe_state_form_1", + :uri => main_url(request_path(info_request)) + "#describe_state_form_1", :user_id => info_request.user.id) post_redirect.save! url = confirm_url(:email_token => post_redirect.email_token) @@ -153,7 +153,7 @@ class RequestMailer < ApplicationMailer 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email @subject = _("Someone has updated the status of your request") - url = main_url(request_url(info_request)) + url = main_url(request_path(info_request)) @body = {:info_request => info_request, :url => url} end diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 2541fd323..825c0e6f7 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -54,7 +54,7 @@ <% end %> <p> - <%= link_to 'Public page', main_url(request_url(@info_request)) %> + <%= link_to 'Public page', main_url(request_path(@info_request)) %> | <%= link_to 'Edit', '../edit/' + @info_request.id.to_s %> | <%= link_to 'FOI officer upload URL', '../generate_upload_url/' + @info_request.id.to_s %> (see also links on incoming messages below) </p> diff --git a/app/views/api/request_events.atom.builder b/app/views/api/request_events.atom.builder index 0fe6ac690..3d46e5376 100644 --- a/app/views/api/request_events.atom.builder +++ b/app/views/api/request_events.atom.builder @@ -8,7 +8,7 @@ atom_feed("xmlns:alaveteli" => "http://www.alaveteli.org/API/v2/RequestEvents/At entry.updated(event.created_at.utc.iso8601) entry.tag!("alaveteli:event_type", event.event_type) - entry.tag!("alaveteli:request_url", main_url(request_url(request))) + entry.tag!("alaveteli:request_url", main_url(request_path(request))) entry.title(request.title) entry.content(event.outgoing_message.body, :type => 'text') diff --git a/app/views/contact_mailer/to_admin_message.rhtml b/app/views/contact_mailer/to_admin_message.rhtml index 0ef744108..d5aa6ac7c 100644 --- a/app/views/contact_mailer/to_admin_message.rhtml +++ b/app/views/contact_mailer/to_admin_message.rhtml @@ -4,7 +4,7 @@ <%= _('Message sent using {{site_name}} contact form, ', :site_name=>site_name)%> <%=(@logged_in_user ? ("logged in as user " + main_url(user_path(@logged_in_user))) : "not logged in")%><% if !@last_request.nil? %> -<%= _('Last request viewed: ')%><%= main_url(request_url(@last_request)) %> +<%= _('Last request viewed: ')%><%= main_url(request_path(@last_request)) %> <% end %> <% if !@last_body.nil? %> <%= _('Last authority viewed: ')%><%= main_url(public_body_path(@last_body)) %> diff --git a/app/views/general/_frontpage_requests_list.rhtml b/app/views/general/_frontpage_requests_list.rhtml index 63d91d85a..fa498dfa7 100644 --- a/app/views/general/_frontpage_requests_list.rhtml +++ b/app/views/general/_frontpage_requests_list.rhtml @@ -21,7 +21,7 @@ <%=link_to h(event.info_request.title), request_path(event.info_request)%> <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> - <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> + <p class="excerpt" onclick="document.location.href='<%=request_path(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> </li> <% end %> </ul> diff --git a/app/views/help/unhappy.rhtml b/app/views/help/unhappy.rhtml index 3966088af..80a4ce779 100644 --- a/app/views/help/unhappy.rhtml +++ b/app/views/help/unhappy.rhtml @@ -62,7 +62,7 @@ to the Scottish Information Commissioner</a>. Information Commissioner, either <% if !@info_request.nil? %> include a link to your request - <strong><%=h main_url(request_url(@info_request)) %></strong> + <strong><%=h main_url(request_path(@info_request)) %></strong> <% else %> include a link to your request on <%= site_name %> <% end %> diff --git a/app/views/request/_wall_listing.rhtml b/app/views/request/_wall_listing.rhtml index 26d34e1a1..e7497f130 100644 --- a/app/views/request/_wall_listing.rhtml +++ b/app/views/request/_wall_listing.rhtml @@ -6,7 +6,7 @@ end %> <div class="request_left"> <div class="requester"> <% if event.event_type == 'sent' %> - <%= _('A new request, <em><a href="{{request_url}}">{{request_title}}</a></em>, was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>request_url(info_request),:request_title=>info_request.title) %> + <%= _('A new request, <em><a href="{{request_url}}">{{request_title}}</a></em>, was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>request_path(info_request),:request_title=>info_request.title) %> <% elsif event.event_type == 'followup_sent' %> <%= _('A <a href="{{request_url}}">follow up</a> to <em>{{request_title}}</em> was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>outgoing_message_url(event.outgoing_message),:request_title=>info_request.title) %> <% elsif event.event_type == 'response' %> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 3c9d0057d..19c8ce193 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -26,7 +26,7 @@ <li> <%= _('{{existing_request_user}} already created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, - or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %> + or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %> </li> </ul></div> <% end %> |