aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_controller.rb8
-rw-r--r--app/views/user/river.rhtml12
-rw-r--r--config/routes.rb3
3 files changed, 21 insertions, 2 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 5809484f1..9a8b92e81 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.64 2009-03-18 02:37:42 francis Exp $
+# $Id: user_controller.rb,v 1.65 2009-04-14 14:51:00 tony Exp $
class UserController < ApplicationController
# Show page about a user
@@ -261,6 +261,12 @@ class UserController < ApplicationController
end
+ # River of News: What's happening with your tracked things
+ def river
+ @results = @user.track_things.collect { |thing|
+ perform_search([InfoRequestEvent], thing.track_query, thing.params[:feed_sortby], nil).results
+ }.flatten.sort { |a,b| b[:model].created_at <=> a[:model].created_at }.first(20)
+ end
private
diff --git a/app/views/user/river.rhtml b/app/views/user/river.rhtml
new file mode 100644
index 000000000..9618e0aa8
--- /dev/null
+++ b/app/views/user/river.rhtml
@@ -0,0 +1,12 @@
+<% @title = 'Recent Events' %>
+
+<div class="single_user">
+ <h1><%=@title%></h1>
+
+ <% for result in @results %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => {
+ :event => result[:model], :info_request => result[:model].info_request } %>
+ <% end %>
+
+</div>
+
diff --git a/config/routes.rb b/config/routes.rb
index 410519e0a..18c6406c1 100644
--- a/config/routes.rb
+++ b/config/routes.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: routes.rb,v 1.85 2009-03-16 15:55:05 tony Exp $
+# $Id: routes.rb,v 1.86 2009-04-14 14:51:00 tony Exp $
ActionController::Routing::Routes.draw do |map|
@@ -55,6 +55,7 @@ ActionController::Routing::Routes.draw do |map|
user.confirm '/c/:email_token', :action => 'confirm'
user.show_user '/user/:url_name', :action => 'show'
user.contact_user '/user/contact/:id', :action => 'contact'
+ user.river '/river', :action => 'river'
end
map.with_options :controller => 'body' do |body|