aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2007-12-24 16:49:34 +0000
committerfrancis <francis>2007-12-24 16:49:34 +0000
commit8b6f0a936e3d989fb6002212560adb58d6b3600d (patch)
treed20857a1099aaede88ab29e979cc9234b5be097c
parentda971428ca4cde737737da30ae49fefa0a5ca93e (diff)
Hmmm, at least link to classifying pages from main request if some responses
haven't been classified yet. Very clumbsy though, right now.
-rw-r--r--app/controllers/request_controller.rb6
-rw-r--r--app/helpers/link_to_helper.rb4
-rw-r--r--app/models/info_request.rb9
-rw-r--r--app/views/request/_classify.rhtml15
-rw-r--r--app/views/request/_correspondence.rhtml10
-rw-r--r--app/views/request/classify.rhtml15
-rw-r--r--app/views/request/show.rhtml22
-rw-r--r--public/stylesheets/main.css4
-rw-r--r--todo.txt5
9 files changed, 56 insertions, 34 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index adb469923..1c5cef751 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.22 2007-12-22 02:52:05 francis Exp $
+# $Id: request_controller.rb,v 1.23 2007-12-24 16:49:36 francis Exp $
class RequestController < ApplicationController
@@ -82,6 +82,10 @@ class RequestController < ApplicationController
flash[:notice] = "Thank you for classifying the response."
redirect_to show_request_url(:id => @info_request)
end
+ if params[:incoming_message_id]
+ # Case when didn't choose radio option, but did submit form
+ flash[:error] = "Please choose whether or not you got some of the information that you wanted."
+ end
@correspondences = @info_request.outgoing_messages + @info_request.incoming_messages
@correspondences.sort! { |a,b| a.sent_at <=> b.sent_at }
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 054bcbf3d..7ef8a8186 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.5 2007-12-20 16:42:43 francis Exp $
+# $Id: link_to_helper.rb,v 1.6 2007-12-24 16:49:36 francis Exp $
module LinkToHelper
@@ -19,7 +19,7 @@ module LinkToHelper
def request_link(info_request)
link_to h(info_request.title), request_url(info_request)
end
-
+
def public_body_url(public_body)
return show_public_body_url(:simple_short_name => simplify_url_part(public_body.short_name), :only_path => true)
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index c295a57a8..d1db6f1a4 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -17,7 +17,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.16 2007-12-11 12:16:29 francis Exp $
+# $Id: info_request.rb,v 1.17 2007-12-24 16:49:36 francis Exp $
require 'digest/sha1'
@@ -116,6 +116,13 @@ class InfoRequest < ActiveRecord::Base
end
end
+ # Return array of unclassified responses
+ def unclassified_responses
+ return self.incoming_messages.select do |msg|
+ not msg.user_classified
+ end
+ end
+
end
diff --git a/app/views/request/_classify.rhtml b/app/views/request/_classify.rhtml
new file mode 100644
index 000000000..cf27d734c
--- /dev/null
+++ b/app/views/request/_classify.rhtml
@@ -0,0 +1,15 @@
+<% form_for(:incoming_message, @info_request ) do |f| %>
+ <h2>Got what you wanted?</h2>
+ <p>Does this response contain any of the information that you requested?</p>
+ <p>
+ <%= radio_button "incoming_message", "contains_information", "true" %>
+ <label for="incoming_message_contains_information_true">Yes, this response contains some or all of the information that I requested.</label>
+ <br>
+ <%= radio_button "incoming_message", "contains_information", "false" %>
+ <label for="incoming_message_contains_information_false">No, this response does not contain any of the information.</label>
+ </p>
+
+ <%= submit_tag "Update" %>
+
+<% end %>
+
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml
index 80f92c50a..ea7ca4e6c 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.rhtml
@@ -28,8 +28,16 @@
<%= incoming_message.mail.friendly_from %> of
<% end %>
<%= public_body_link(@info_request.public_body) %>
- wrote a reply on <strong><%= simple_date(incoming_message.sent_at)
+ <% if incoming_message.contains_information %>
+ sent some <strong>useful information</strong>
+ <% else %>
+ replied
+ <% end %>
+ on <strong><%= simple_date(incoming_message.sent_at)
%></strong>
+ <% if not incoming_message.user_classified %>
+ &mdash; please <%= link_to "classify this response", classify_request_url(:incoming_message_id => incoming_message.id) %>
+ <% end %>
</p>
<% else %>
<% raise "Unknown correspondence type " + correspondence.class.to_s %>
diff --git a/app/views/request/classify.rhtml b/app/views/request/classify.rhtml
index c6ce42d14..15789858e 100644
--- a/app/views/request/classify.rhtml
+++ b/app/views/request/classify.rhtml
@@ -10,20 +10,7 @@
<% if not @incoming_message.user_classified %>
<div id="classify_action">
- <% form_for(:incoming_message, @info_request ) do |f| %>
- <h2>Got what you wanted?</h2>
- <p>Does this response contain any of the information that you requested?</p>
- <p>
- <%= radio_button "incoming_message", "contains_information", "true" %>
- <label for="incoming_message_contains_information_true">Yes, this response contains some or all of the information that I requested.</label>
- <br>
- <%= radio_button "incoming_message", "contains_information", "false" %>
- <label for="incoming_message_contains_information_false">No, this response does not contain any of the information.</label>
- </p>
-
- <%= submit_tag "Update" %>
-
- <% end %>
+ <%= render :partial => 'classify' %>
<div>
<% end %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 83e183c81..99ba55d11 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -11,18 +11,24 @@
<p id="request_status">
<% if @status == 'awaiting' %>
- Currently <strong>waiting for a response</strong> from <%= public_body_link(@info_request.public_body) %>
+ Currently <strong>waiting for a response</strong> from <%= public_body_link(@info_request.public_body) %>
<% elsif @status == 'overdue' %>
- Currently <strong>overdue a response</strong> from <%=
- public_body_link(@info_request.public_body) %>. Under section blah of the
- Freedom of Information Act 2000 responses must be made within 20 working days.
+ Currently <strong>overdue a response</strong> from <%=
+ public_body_link(@info_request.public_body) %>. Under section blah of the
+ Freedom of Information Act 2000 responses must be made within 20 working days.
<% elsif @status == 'information' %>
- The request was at least partly <strong>successful</strong>.
+ The request was at least partly <strong>successful</strong>.
<% elsif @status == 'none' %>
- The request is <strong>not (yet) successful</strong>.
+ The request is <strong>not (yet) successful</strong>.
<% elsif @status == 'unknown' %>
- <strong>Response received</strong>, but <%= user_link(@info_request.user) %> has not yet reported if it was
- successful or a rejection.
+ <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.
+ <!-- This will be useful here too: @info_request.unclassified_responses -->
<% else %>
<% raise "unknown status " + $status %>
<% end %>
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index 301068d06..b4615b648 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -263,12 +263,12 @@ table#list_requests .odd {
/* /classify - classifying requests */
#classify_action {
- float: right;
+ float: left;
width: 35%;
}
#classify_view {
- float: left;
+ float: right;
width: 60%;
}
diff --git a/todo.txt b/todo.txt
index 47a5d82ac..61f78625b 100644
--- a/todo.txt
+++ b/todo.txt
@@ -23,8 +23,6 @@ Track bounce messages via a separate address
- just record if they are bounce, and any DSN, for now
- and say in display "automatic message"
-Swap over the question as to if contains info to be on the left
-
Formatting of emails
- don't show HTML and plain version, just show one
- do simple quotation folding
@@ -32,15 +30,12 @@ Formatting of emails
Either rotate log files, or merge with Apache ones
-Format user emails as well as request ones
-
Let requester send follow-ups - but to which email address???!! aargh
Do something after 20 working days if you get no response
Work out how to get it to tell you code coverage of .rhtml files
Make it validate the HTML
maybe with http://www.anodyne.ca/wp-content/uploads/2007/09/be_valid_xhtml.rb
-Check we call integrate_views for all controllers
Test that actually sending request outgoing mail using deliveries
Remove "Outgoing messages is invalid" error