aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb7
-rw-r--r--app/models/info_request.rb28
-rw-r--r--app/views/request/_request_listing.rhtml21
-rw-r--r--app/views/request/_sidebar_request_listing.rhtml16
-rw-r--r--app/views/request/show.rhtml6
5 files changed, 55 insertions, 23 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index d02694183..b3689cefc 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.60 2008-02-27 13:59:51 francis Exp $
+# $Id: request_controller.rb,v 1.61 2008-02-28 14:04:45 francis Exp $
class RequestController < ApplicationController
@@ -29,6 +29,11 @@ class RequestController < ApplicationController
last_event = @events_needing_description[-1]
@last_info_request_event_id = last_event.nil? ? nil : last_event.id
@new_responses_count = @events_needing_description.select {|i| i.event_type == 'response'}.size
+
+ # Sidebar stuff
+ @info_requests_same_user_same_body = InfoRequest.find(:all, :order => "created_at desc",
+ :conditions => ["prominence = 'normal' and user_id = ? and public_body_id = ?", @info_request.user_id, @info_request.public_body_id],
+ :limit => 5)
end
def list
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 6a72af2f9..5eab7ba4d 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -21,7 +21,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.49 2008-02-27 14:01:30 francis Exp $
+# $Id: info_request.rb,v 1.50 2008-02-28 14:04:46 francis Exp $
require 'digest/sha1'
@@ -345,6 +345,31 @@ public
end
end
+ # Display versino of status
+ def display_status
+ status = self.calculate_status
+ if self.awaiting_description
+ "Awaiting classification"
+ elsif status == 'waiting_response'
+ "Awaiting response."
+ elsif status == 'waiting_response_overdue'
+ "Response overdue."
+ elsif status == 'partially_successful'
+ "Partially successful."
+ elsif status == 'rejected'
+ "Rejected."
+ elsif status == 'successful'
+ "Successful."
+ elsif status == 'waiting_clarification'
+ "Waiting clarification."
+ elsif status == 'requires_admin'
+ "Unusual response."
+ else
+ raise "unknown status " + status
+ end
+ end
+
+
protected
# Called by incoming_email and envelope_email
@@ -368,7 +393,6 @@ public
end
end
-
end
diff --git a/app/views/request/_request_listing.rhtml b/app/views/request/_request_listing.rhtml
index 623ccf535..4c31f470a 100644
--- a/app/views/request/_request_listing.rhtml
+++ b/app/views/request/_request_listing.rhtml
@@ -1,5 +1,4 @@
<% for info_request in info_requests %>
- <% status = info_request.calculate_status %>
<p class="request_listing">
<%= request_link(info_request) %>
@@ -9,25 +8,7 @@
<span class="request_listing_bottomline">
<strong>
- <% if info_request.awaiting_description %>
- Awaiting classification.
- <% elsif status == 'waiting_response' %>
- Awaiting response.
- <% elsif status == 'waiting_response_overdue' %>
- Response overdue.
- <% elsif status == 'partially_successful' %>
- Partially successful.
- <% elsif status == 'rejected' %>
- Rejected.
- <% elsif status == 'successful' %>
- Successful.
- <% elsif status == 'waiting_clarification' %>
- Waiting clarification.
- <% elsif status == 'requires_admin' %>
- Unusual response.
- <% else %>
- <% raise "unknown status " + status %>
- <% end %>
+ <%= info_request.display_status %>
</strong>
Requested from <%= public_body_link(info_request.public_body) %>
diff --git a/app/views/request/_sidebar_request_listing.rhtml b/app/views/request/_sidebar_request_listing.rhtml
new file mode 100644
index 000000000..b18075549
--- /dev/null
+++ b/app/views/request/_sidebar_request_listing.rhtml
@@ -0,0 +1,16 @@
+<% for info_request in info_requests %>
+ <p class="request_listing">
+ <%= request_link(info_request) %>
+
+ <br>
+ <%=h excerpt(info_request.initial_request_text, "", 300) %>
+ <br>
+
+ <span class="request_listing_bottomline">
+ <strong>
+ <%= info_request.display_status %>
+ </strong>
+ Requested on <%= simple_date(info_request.created_at) %>.
+ </span>
+ </p>
+<% end %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 46dadce89..e98aabb70 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -64,6 +64,12 @@
</div>
<div id="request_sidebar">
+ <% if @info_requests_same_user_same_body.size > 0 %>
+ <h2>Some other requests made by
+ <%= user_link(@info_request.user) %> to <%= public_body_link(@info_request.public_body) %></h2>
+ <%= render :partial => 'sidebar_request_listing', :locals => { :info_requests => @info_requests_same_user_same_body } %>
+ <% end %>
+
<!--<h2>Juicy stuff will be here</h2>
<p>For now it is just padding to make the messages on the left
narrower, so I can see what the formatting is like.