diff options
-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 | ||||
-rw-r--r-- | config/environment.rb | 2 | ||||
-rw-r--r-- | config/general-example | 6 | ||||
-rw-r--r-- | config/routes.rb | 3 | ||||
-rw-r--r-- | public/stylesheets/main.css | 7 | ||||
-rw-r--r-- | todo.txt | 3 |
9 files changed, 81 insertions, 8 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 %> + + diff --git a/config/environment.rb b/config/environment.rb index 4325def66..807ee4982 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -61,6 +61,8 @@ Rails::Initializer.run do |config| config.active_record.default_timezone = :utc # See Rails::Configuration for more options + ENV['RECAPTCHA_PUBLIC_KEY'] = MySociety::Config::get("RECAPTCHA_PUBLIC_KEY") + ENV['RECAPTCHA_PRIVATE_KEY'] = MySociety::Config::get("RECAPTCHA_PRIVATE_KEY") end # Add new inflection rules using the following format diff --git a/config/general-example b/config/general-example index 2a7a0b140..e766293cc 100644 --- a/config/general-example +++ b/config/general-example @@ -19,7 +19,7 @@ * Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. * Email: francis@mysociety.org; WWW: http://www.mysociety.org * - * $Id: general-example,v 1.15 2008-06-12 13:43:30 francis Exp $ + * $Id: general-example,v 1.16 2008-10-17 11:38:00 francis Exp $ * */ @@ -42,4 +42,8 @@ define('OPTION_ADMIN_PUBLIC_URL', '/'); // where /stylesheets sits under for adm // Secret key for signing cookie_store sessions define('OPTION_COOKIE_STORE_SESSION_SECRET', 'your secret key here, make it long and random'); +// Recaptcha, for detecting humans. Get keys here: http://recaptcha.net/whyrecaptcha.html +define('OPTION_RECAPTCHA_PUBLIC_KEY', ''); +define('OPTION_RECAPTCHA_PRIVATE_KEY', ''); + ?> diff --git a/config/routes.rb b/config/routes.rb index d93d7004d..edda39af1 100644 --- a/config/routes.rb +++ b/config/routes.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: routes.rb,v 1.74 2008-09-15 16:16:35 francis Exp $ +# $Id: routes.rb,v 1.75 2008-10-17 11:38:00 francis Exp $ ActionController::Routing::Routes.draw do |map| @@ -60,6 +60,7 @@ ActionController::Routing::Routes.draw do |map| body.list_public_bodies "/body", :action => 'list' body.list_public_bodies "/body/list/:tag", :action => 'list' body.show_public_body "/body/:url_name", :action => 'show' + body.view_public_body_email "/body/:url_name/view_email", :action => 'view_email' end map.with_options :controller => 'comment' do |comment| diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 2109004ab..e7426b94d 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -296,6 +296,13 @@ dd { margin: 0.6em 0 2em 4em; width: 33em; } padding: 1em 0em 1em 0em; background-color: #e0e0e0; } +#stepwise_make_request_view_email +{ + text-align: center; + margin: 0em 0em 0em 0em; + padding: 1em 0em 1em 0em; + background-color: #e0e0e0; +} #frontpage_examples div#examples_0 { float: left; margin-left: 0%; @@ -30,6 +30,9 @@ Remember - internal reviews can be *aborted* if they just send the response :) Request withdrawn by user status/marker? +When people say still waiting, give link to unhappy if it is late? Or put +link on page when it is late? + Clear out all the need admin attention requests Merge workflow into one stream - find information, if you can't find it then request it. |