aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_controller.rb6
-rw-r--r--app/models/track_thing.rb21
-rw-r--r--app/views/user/show.rhtml26
-rw-r--r--todo.txt1
4 files changed, 40 insertions, 14 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index c6eaeea68..c4a9c49e1 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.54 2008-08-21 01:26:11 francis Exp $
+# $Id: user_controller.rb,v 1.55 2008-09-02 23:50:27 francis Exp $
class UserController < ApplicationController
# Show page about a user
@@ -25,6 +25,10 @@ class UserController < ApplicationController
# 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)
end
# Login form
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 9bb771961..f014c215a 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.38 2008-08-31 12:46:53 francis Exp $
+# $Id: track_thing.rb,v 1.39 2008-09-02 23:50:27 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
@@ -48,6 +48,25 @@ class TrackThing < ActiveRecord::Base
'feed'
]
+ def TrackThing.track_type_description(track_type)
+ if track_type == 'request_updates'
+ "Individual requests"
+ elsif track_type == 'all_new_requests' || track_type == "all_successful_requests"
+ "Many requests"
+ elsif track_type == 'public_body_updates'
+ "Public authorities"
+ elsif track_type == 'user_updates'
+ "People"
+ elsif track_type == 'search_query'
+ "Search queries"
+ else
+ raise "internal error " + track_type
+ end
+ end
+ def track_type_description
+ TrackThing.track_type_description(self.track_type)
+ end
+
def TrackThing.create_track_for_request(info_request)
track_thing = TrackThing.new
track_thing.track_type = 'request_updates'
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index 4a5ac33f0..d15b75bb5 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -35,16 +35,20 @@
</p>
<% end %>
- <% track_things = TrackThing.find(:all, :conditions => ["tracking_user_id = ? and track_medium = ?", @display_user.id, 'email_daily'], :order => 'created_at desc') %>
- <% if @is_you and not track_things.empty? %>
+ <% if @is_you and not @track_things.empty? %>
<h2>
- Your <%=pluralize(track_things.size, "email subscription") %>
+ Your <%=pluralize(@track_things.size, "email subscription") %>
</h2>
+ <% for track_type_description, track_things in @track_things_grouped %>
+ <% if @track_things_grouped.size > 1 %>
+ <h3>
+ <%=track_type_description%>
+ </h3>
+ <% end %>
- <ul>
- <% for track_thing in track_things %>
- <li>
- <% if @is_you %>
+ <ul>
+ <% for track_thing in track_things %>
+ <li>
<% form_tag :controller => 'track', :action => 'update', :track_id => track_thing.id do %>
<%= track_thing.params[:list_description] %>
<%= hidden_field_tag 'track_medium', "delete" %>
@@ -52,12 +56,10 @@
<%= submit_tag "unsubscribe" %>
<% end %>
<!-- (<%= link_to "view latest updates", :controller => 'general', :action => 'search', :query => track_thing.track_query %>) -->
- <% else %>
- <%= track_thing.params[:list_description] %>
- <% end %>
- </li>
+ </li>
+ <% end %>
+ </ul>
<% end %>
- </ul>
<% end %>
<% if @display_user.info_requests.empty? %>
diff --git a/todo.txt b/todo.txt
index 574f0390d..b1f1a910d 100644
--- a/todo.txt
+++ b/todo.txt
@@ -26,6 +26,7 @@ Internal review status/marker?
http://www.whatdotheyknow.com/request/online_petitions_documents_from
http://www.whatdotheyknow.com/request/ombudsmans_case_load#comment-21
(search for phrase "internal review"!)
+Remember - internal reviews can be *aborted* if they just send the response :)
Request mailed by post to user (maybe), and not uploaded
http://www.whatdotheyknow.com/request/archaeology_south_easts_responsi