diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application.rb | 3 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 36 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 8 | ||||
-rw-r--r-- | app/helpers/link_to_helper.rb | 19 | ||||
-rw-r--r-- | app/models/info_request.rb | 13 | ||||
-rw-r--r-- | app/views/help/about.rhtml | 2 | ||||
-rw-r--r-- | app/views/help/unhappy.rhtml | 54 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 14 | ||||
-rw-r--r-- | app/views/request/_describe_state.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/describe_state.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 16 |
11 files changed, 135 insertions, 46 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 23b6e376b..83c606ad2 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.27 2008-01-22 17:59:50 francis Exp $ +# $Id: application.rb,v 1.28 2008-01-29 03:05:46 francis Exp $ class ApplicationController < ActionController::Base @@ -112,7 +112,6 @@ class ApplicationController < ActionController::Base # URL generating functions are needed by all controllers (for redirects) # and views (for links), so include them into all of both. include LinkToHelper - end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 945db8931..9e06a027b 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_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: request_controller.rb,v 1.41 2008-01-29 01:26:21 francis Exp $ +# $Id: request_controller.rb,v 1.42 2008-01-29 03:05:46 francis Exp $ class RequestController < ApplicationController @@ -16,6 +16,7 @@ class RequestController < ApplicationController @date_response_required_by = @info_request.date_response_required_by @collapse_quotes = params[:unfold] ? false : true @is_owning_user = !authenticated_user.nil? && authenticated_user.id == @info_request.user_id + @needing_description = @info_request.incoming_messages_needing_description end def list @@ -78,12 +79,7 @@ class RequestController < ApplicationController # Page describing state of message posts to def describe_state @info_request = InfoRequest.find(params[:id]) - if @info_request.described_last_incoming_message_id.nil? - @correspondences = @info_request.incoming_messages.find(:all) - else - @correspondences = @info_request.incoming_messages.find(:all, :conditions => "id > " + @info_request.described_last_incoming_message_id.to_s) - end - @correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } + @needing_description = @info_request.incoming_messages_needing_description @is_owning_user = !authenticated_user.nil? && authenticated_user.id == @info_request.user_id if not @info_request.awaiting_description @@ -111,12 +107,30 @@ class RequestController < ApplicationController end @info_request.awaiting_description = false - @info_request.described_last_incoming_message_id = @correspondences[-1].id # XXX lock this with InfoRequest.receive + @info_request.described_last_incoming_message_id = @needing_description[-1].id # XXX lock this with InfoRequest.receive @info_request.described_state = params[:incoming_message][:described_state] @info_request.save! - flash[:notice] = "Thank you for answering!" - # XXX need to prompt for followups here - redirect_to show_request_url(:id => @info_request) + if @info_request.described_state == 'waiting_response' + flash[:notice] = "<p>Thank you! Hopefully your wait isn't too long.</p> <p>By law, you should get a response before the end of <strong>" + simple_date(@info_request.date_response_required_by) + "</strong>.</p>" + redirect_to show_request_url(:id => @info_request) + elsif @info_request.described_state == 'rejected' + # XXX explain how to complain + flash[:notice] = "Oh no! Sorry to hear that your request was rejected. Here is what to do now." + redirect_to unhappy_url + elsif @info_request.described_state == 'successful' + flash[:notice] = "We're glad you got all the information that you wanted. Thank you for using GovernmentSpy." + # XXX quiz them here for a comment + redirect_to show_request_url(:id => @info_request) + elsif @info_request.described_state == 'partially_successful' + flash[:notice] = "We're glad you got some of the information that you wanted." + # XXX explain how to complain / quiz them for a comment + redirect_to show_request_url(:id => @info_request) + elsif @info_request.described_state == 'waiting_clarification' + flash[:notice] = "Please write your follow up message containing the necessary clarifications below." + redirect_to show_response_url(:id => @info_request.id, :incoming_message_id => @needing_description[-1].id) + else + raise "unknown described_state " + @info_request.described_state + end return end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ce78011a0..e40313d1f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application_helper.rb,v 1.15 2008-01-21 19:12:46 francis Exp $ +# $Id: application_helper.rb,v 1.16 2008-01-29 03:05:47 francis Exp $ module ApplicationHelper # URL generating functions are needed by all controllers (for redirects) @@ -41,11 +41,5 @@ module ApplicationHelper '' end end - - # Basic date format - def simple_date(date) - return date.strftime("%e %B %Y") - end - end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index cfa61ec4d..79bdcd904 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.11 2008-01-22 18:51:21 francis Exp $ +# $Id: link_to_helper.rb,v 1.12 2008-01-29 03:05:47 francis Exp $ module LinkToHelper @@ -52,11 +52,11 @@ module LinkToHelper end - def info_request_link(info_request) link_to h(info_request.title), show_request_url(:id => info_request) end + # Simplified links to our objects # XXX See controllers/user_controller.rb controllers/body_controller.rb for inverse # XXX consolidate somehow with stuff in helpers/application_helper.rb @@ -72,6 +72,15 @@ module LinkToHelper return admin_url_prefix + relative_path end + # About page URLs + def about_url + return help_general_url :action => 'about' + end + def unhappy_url + return help_general_url :action => 'unhappy' + end + + # Where stylesheets used by admin page sit under def admin_public_url(relative_path) admin_url_prefix = MySociety::Config.get("ADMIN_PUBLIC_URL", "/") @@ -82,6 +91,12 @@ module LinkToHelper url_prefix = "http://" + MySociety::Config.get("DOMAIN", '127.0.0.1:3000') return url_prefix + relative_path end + + # Basic date format + def simple_date(date) + return date.strftime("%e %B %Y") + end + end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 0207bca94..a417ecc3c 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -20,7 +20,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.30 2008-01-29 01:26:21 francis Exp $ +# $Id: info_request.rb,v 1.31 2008-01-29 03:05:47 francis Exp $ require 'digest/sha1' @@ -216,6 +216,17 @@ public return excerpt end + # Returns all the messages which the user hasn't described yet + def incoming_messages_needing_description + if self.described_last_incoming_message_id.nil? + correspondences = self.incoming_messages.find(:all) + else + correspondences = self.incoming_messages.find(:all, :conditions => "id > " + self.described_last_incoming_message_id.to_s) + end + correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } + return correspondences + end + protected # Called by incoming_email and envelope_email diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml index ac92602bf..f0524ea28 100644 --- a/app/views/help/about.rhtml +++ b/app/views/help/about.rhtml @@ -1,3 +1,5 @@ +<% @title = "About" %> + <dt>Is this site still in development?</dt> <dd>Yes, that's right. The site is currently being tested with a handful of diff --git a/app/views/help/unhappy.rhtml b/app/views/help/unhappy.rhtml new file mode 100644 index 000000000..a76b2c93c --- /dev/null +++ b/app/views/help/unhappy.rhtml @@ -0,0 +1,54 @@ +<% @title = "Unhappy about a Freedom of Information request?" %> + +<h1>Unhappy about the response you got?</h1> + +<p>If ...</p> + +<ul> +<li>You didn't get a reply within 20 working days</li> +<li>You did not get all of the information that you requested <strong>or</strong></li> +<li>Your request was rejected, but without a reason valid under the law</li> +</ul> + +<p>... you can</p> + +<ol> +<li>Ask for an Internal Review at the public body.</li> +<li>If that doesn't help, complain to the Information Commisioner.</li> +</ol> + +<h1>1. Asking for an Internal Review</h1> + +<p>Contact the Freedom of Information officer at the public body and request an +internal review. +</p> + +<p>You should be able to find the email address for this +by searching the website of the public body. If you filed your request using +GovernmentSpy, you can include a link to the page about your request, so the +internal review has easy access to all the relevant correspondence. +</p> + +<p>The Internal Review should take 2-3 weeks for simple cases, and up to 6 +weeks even for complex reviews. You will then either get the information that +you originally requested, or you will be told that the review upholds the +original decision. +</p> + +<!-- XXX need decent link to more detailed instructions --> + +<h1>2. Complaining to the Information Commissioner</h1> + +<!-- XXX should include brief instructions inline, and link to more detail --> + +<p>If you are still unhappy after the public body had had an internal review, +then you can complain to the Information Commisioner. To do this read +<a href="http://www.ico.gov.uk/complaints/freedom_of_information.aspx">Complaints about Freedom of Information</a> +on the Information Commisioner's website. + +<p>Again, you can include a link to your request on GovernmentSpy, or print +out the whole page of your request, to make it easy to send the relevant information +to the Information Commissioner. + + + diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index d9b62cdaa..02398dc01 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -41,15 +41,15 @@ </div> <% end %> - <% if flash[:notice] %> - <div id="notice"><%= flash[:notice] %></div> - <% end %> - <% if flash[:error] %> - <div id="error"><%= flash[:error] %></div> - <% end %> - <div id="wrapper"> <div id="content"> + <% if flash[:notice] %> + <div id="notice"><%= flash[:notice] %></div> + <% end %> + <% if flash[:error] %> + <div id="error"><%= flash[:error] %></div> + <% end %> + <div id="<%= controller.controller_name + "_" + controller.action_name %>"> <%= yield :layout %> </div> diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index 22336972f..068a9fdd5 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -1,8 +1,6 @@ <% if @is_owning_user %> <% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %> - <h2>What are you doing about this request now?</h2> - <p>Filling this in each time you get a new response helps us track the progress of your request. - </p> + <h2>What is the status of this request now?</h2> <p> <%= radio_button "incoming_message", "described_state", "waiting_response" %> <label for="incoming_message_described_state_waiting_response">I'm still <strong>waiting</strong> for a response</label> @@ -14,11 +12,13 @@ <label for="incoming_message_described_state_rejected">My request has been <strong>rejected</strong></label> <br> <%= radio_button "incoming_message", "described_state", "successful" %> - <label for="incoming_message_described_state_successful">I've received (nearly) <strong>all the information</strong> that I asked for</label> + <label for="incoming_message_described_state_successful">I've received <strong>all the information</strong> (or equivalents) that I asked for</label> <br> <%= radio_button "incoming_message", "described_state", "partially_successful" %> <label for="incoming_message_described_state_partially_successful">I've received <strong>some of the information</strong> that I asked for</label> </p> + <p>Filling this in each time you get a new response helps us track the progress of your request. + </p> <%= hidden_field_tag 'submitted_describe_state', 1 %> <%= submit_tag "Next >>" %> diff --git a/app/views/request/describe_state.rhtml b/app/views/request/describe_state.rhtml index 4c3e9d006..a73bd1611 100644 --- a/app/views/request/describe_state.rhtml +++ b/app/views/request/describe_state.rhtml @@ -1,4 +1,5 @@ -<% @title = "New responses to '" + h(@info_request.title) + "'" %> +<% @title = MySociety::Format.fancy_pluralize(@needing_description.size, 'New response', 'new responses') + + " to '" + h(@info_request.title) + "'" %> <%= foi_error_messages_for :incoming_message, :outgoing_message %> @@ -7,9 +8,10 @@ </div> <div id="show_response_view"> - <h2>New responses to your request '<%= request_link @info_request %>'</h2> + <h2><%=MySociety::Format.fancy_pluralize(@needing_description.size, 'New response', 'new responses') %> + to your request '<%= request_link @info_request %>'</h2> - <% for correspondence in @correspondences %> + <% for correspondence in @needing_description %> <%= render :partial => 'correspondence', :locals => { :correspondence => correspondence } %> <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 89726054c..dc47de333 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -19,9 +19,12 @@ <% if @info_request.awaiting_description %> <% if @is_owning_user %> Please <strong>answer the question above</strong> so we know whether the - most recent response you got contained useful information. + <%= MySociety::Format.fancy_pluralize(@needing_description.size, 'recent response contains', 'recent responses contain') %> useful information. <% else %> - This request is <strong>awaiting description</strong> by <%= user_link(@info_request.user) %> + This request has an <strong>unknown status</strong>. We're waiting for + <%= user_link(@info_request.user) %> to read + <%= MySociety::Format.fancy_pluralize(@needing_description.size, 'a recent response', 'recent responses') %> + and update the status. <% end %> <% elsif @status == 'waiting_response' %> Currently <strong>waiting for a response</strong> from <%= public_body_link(@info_request.public_body) %>, @@ -38,13 +41,8 @@ <% elsif @status == 'partially_successful' %> The request was <strong>partially successful</strong>. <% elsif @status == 'waiting_clarification' %> - <strong><%= MySociety::Format.fancy_pluralize(@info_request.incoming_messages.size, 'Response', 'responses') %> - received</strong>, - but <%= user_link(@info_request.user) %> has not yet reported whether - <%= @info_request.incoming_messages.size == 1 ? 'it' : 'they' %> - contained useful information or not. - - If you are <%= user_link(@info_request.user) %>, please classify them below. + The request is <strong>waiting clarification</strong> + by <%= user_link(@info_request.user) %>. <% else %> <% raise "unknown status " + @status %> <% end %> |