diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/body_controller.rb | 20 | ||||
-rw-r--r-- | app/views/body/show.rhtml | 8 | ||||
-rw-r--r-- | app/views/body/view_email.rhtml | 24 | ||||
-rw-r--r-- | app/views/body/view_email_captcha.rhtml | 16 |
4 files changed, 62 insertions, 6 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb index 1b113252f..7a07daf39 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/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: body_controller.rb,v 1.18 2008-10-07 22:05:06 francis Exp $ +# $Id: body_controller.rb,v 1.19 2008-10-17 11:37:59 francis Exp $ class BodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -14,8 +14,7 @@ class BodyController < ApplicationController return end - @public_bodies = PublicBody.find(:all, - :conditions => [ "url_name = ?", params[:url_name] ]) + @public_bodies = PublicBody.find(:all, :conditions => [ "url_name = ?", params[:url_name] ]) if @public_bodies.size > 1 raise "Two bodies with the same URL name: " . params[:url_name] end @@ -38,6 +37,21 @@ class BodyController < ApplicationController @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end + def view_email + @public_bodies = PublicBody.find(:all, :conditions => [ "url_name = ?", params[:url_name] ]) + @public_body = @public_bodies[0] + + if params[:submitted_view_email] + if verify_recaptcha + flash[:error] = nil + render :template => "body/view_email" + return + end + flash[:error] = "There was an error with the words you entered, please try again." + end + render :template => "body/view_email_captcha" + end + def list @tag = params[:tag] if @tag.nil? diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml index 58a1abc73..ed0d44571 100644 --- a/app/views/body/show.rhtml +++ b/app/views/body/show.rhtml @@ -3,15 +3,17 @@ <div id="request_sidebar"> <h2>Track this authority</h2> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %> + <h2>More about this authority</h2> + <% if !@public_body.calculated_home_page.nil? %> + <%= link_to "Home page", @public_body.calculated_home_page %><br> + <% end %> + <%= link_to "View FOI email address", view_public_body_email_url(@public_body.url_name) %> </div> <h1><%=h(@public_body.name)%></h1> <p class="subtitle"> <%=@public_body.type_of_authority(true)%> in the UK<% if not @public_body.short_name.empty? %>, also called <%= h(@public_body.short_name) %><% end %> -<% if !@public_body.calculated_home_page.nil? %> - (<%= link_to "home page", @public_body.calculated_home_page %>) -<% end %> <% if !@user.nil? && @user.admin_page_links? %> (<%= link_to "admin", public_body_admin_url(@public_body) %>) <% end %> diff --git a/app/views/body/view_email.rhtml b/app/views/body/view_email.rhtml new file mode 100644 index 000000000..9c61ff0fa --- /dev/null +++ b/app/views/body/view_email.rhtml @@ -0,0 +1,24 @@ +<% @title = "FOI email address for '" + h(@public_body.name) + "'" %> + +<h1>FOI email address for '<%=public_body_link(@public_body)%>'</h1> + +<p> + WhatDoTheyKnow sends new requests to <strong><%=h @public_body.request_email%></strong> for this authority. +</p> + +<p> + If the address is wrong, or you know a better address, please <a href="/help/contact">contact us</a>. +</p> + +<div id="stepwise_make_request_view_email"> + <strong> + <% if @public_body.eir_only? %> + <%= link_to "Make a new EIR request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> + <% else %> + <%= link_to "Make a new FOI request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> + <% end %> + to <%= h(@public_body.name) %> + </strong> +</div> + + diff --git a/app/views/body/view_email_captcha.rhtml b/app/views/body/view_email_captcha.rhtml new file mode 100644 index 000000000..13741c292 --- /dev/null +++ b/app/views/body/view_email_captcha.rhtml @@ -0,0 +1,16 @@ +<% @title = "View FOI email address for '" + h(@public_body.name) + "'" %> + +<h1>View FOI email address for '<%=public_body_link(@public_body)%>'</h1> + +<p>To view the email address that we use to send FOI requests to <%=h @public_body.name%>, +please enter these words.<p> + +<% form_for :contact do |f| %> + <%= recaptcha_tags %> + + <%= hidden_field_tag(:submitted_view_email, { :value => 1 } ) %> + + <p><%= submit_tag "View email" %></p> +<% end %> + + |