aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_controller.rb12
-rw-r--r--app/views/user/show.rhtml20
-rw-r--r--todo.txt1
3 files changed, 22 insertions, 11 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index c4a9c49e1..2c98bfd7d 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_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: user_controller.rb,v 1.55 2008-09-02 23:50:27 francis Exp $
+# $Id: user_controller.rb,v 1.56 2008-09-08 16:38:32 francis Exp $
class UserController < ApplicationController
# Show page about a user
@@ -22,13 +22,19 @@ class UserController < ApplicationController
@is_you = !@user.nil? && @user.id == @display_user.id
+ # Use search query for this so can collapse and paginate easily
+ @xapian_requests = perform_search([InfoRequestEvent], 'requested_by:' + @display_user.url_name, 'newest', 'request_collapse')
+ @xapian_comments = perform_search([InfoRequestEvent], 'commented_by:' + @display_user.url_name, 'newest', nil)
+
# Track corresponding to this page
@track_thing = TrackThing.create_track_for_user(@display_user)
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ]
# All tracks for the user
- @track_things = TrackThing.find(:all, :conditions => ["tracking_user_id = ? and track_medium = ?", @display_user.id, 'email_daily'], :order => 'created_at desc')
- @track_things_grouped = @track_things.group_by(&:track_type_description)
+ if @is_you
+ @track_things = TrackThing.find(:all, :conditions => ["tracking_user_id = ? and track_medium = ?", @display_user.id, 'email_daily'], :order => 'created_at desc')
+ @track_things_grouped = @track_things.group_by(&:track_type_description)
+ end
end
# Login form
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index d15b75bb5..452c14b3b 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -62,31 +62,35 @@
<% end %>
<% end %>
- <% if @display_user.info_requests.empty? %>
+ <% if @xapian_requests.results.empty? %>
<h2>Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %></h2>
<p><%= @is_you ? 'You have' : 'This person has' %>
made no Freedom of Information requests using this site.</p>
<% else %>
<h2>
- <%= @is_you ? 'Your ' : "This person's " %>
- <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %>
+ <%= @is_you ? 'Your ' : "This person's " %>
+ <%=pluralize(@xapian_requests.matches_estimated, "Freedom of Information request") %>
</h2>
- <%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests } %>
+ <% for result in @xapian_requests.results %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
+ <% end %>
+
+ <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated) %>
<% end %>
- <% if @display_user.comments.empty? %>
+ <% if @xapian_comments.results.empty? %>
<h2><%= @is_you ? 'Your' : 'This person\'s' %> annotations</h2>
<p>None made.</p>
<% else %>
<h2>
<%= @is_you ? 'Your ' : "This person's " %>
- <%=pluralize(@display_user.comments.size, "annotation") %>
+ <%=pluralize(@xapian_comments.matches_estimated, "annotation") %>
</h2>
- <% for comment in @display_user.comments %>
- <%= render :partial => 'request/request_listing_via_event', :locals => { :event => comment.info_request_events[0], :info_request => comment.info_request } %>
+ <% for result in @xapian_comments.results %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
<% end %>
</div>
diff --git a/todo.txt b/todo.txt
index 456e28582..5e2097a67 100644
--- a/todo.txt
+++ b/todo.txt
@@ -86,6 +86,7 @@ Add "Who should I make my request to?"
Add "I want to file squillions of requests"
Add "I didn't get the email / spam question" and link to from FOI offcier upload page
Add "Postal replies stuff" and link to from FOI officer upload page
+Add "I'm not sure which authority to make my request to" - make flow better after first section, to abrupt now
Simple initial bulk request prevention (see Tony's mail on this)
Don't let somebody file a new request if they haven't classified all existing ones?