diff options
-rw-r--r-- | app/controllers/public_body_controller.rb | 9 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 18 |
2 files changed, 19 insertions, 8 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index b668cb576..c1b39e063 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body_controller.rb,v 1.1 2009-06-22 12:54:44 francis Exp $ +# $Id: public_body_controller.rb,v 1.2 2009-07-01 18:16:33 francis Exp $ class PublicBodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -23,6 +23,13 @@ class PublicBodyController < ApplicationController set_last_body(@public_body) + top_url = main_url("/") + @searched_to_send_request = false + referrer = request.env['HTTP_REFERER'] + if !referrer.nil? && referrer.match(%r{^#{top_url}search/.*/bodies$}) + @searched_to_send_request = true + end + # Use search query for this so can collapse and paginate easily # XXX really should just use SQL query here rather than Xapian. begin diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index cb6b00260..f28581cdd 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -36,13 +36,17 @@ <div id="stepwise_make_request"> <strong> <% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %> - Next, - <% if @public_body.eir_only? %> - <%= link_to "make a new Environmental Information request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> - <% else %> - <%= link_to "make a new Freedom of Information request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> - <% end %> - to <%= h(@public_body.name) %> + <% make = 'Make' %> + <% if @searched_to_send_request %> + Next, + <% make = 'make' %> + <% end %> + <% if @public_body.eir_only? %> + <%= link_to make + " a new Environmental Information request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> + <% else %> + <%= link_to make + " a new Freedom of Information request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> + <% end %> + to <%= h(@public_body.name) %> <% elsif @public_body.has_notes? %> <%= @public_body.notes_as_html %> <% elsif @public_body.not_requestable_reason == 'not_apply' %> |