diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/track_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/user_controller.rb | 5 |
2 files changed, 20 insertions, 2 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 970b2a52a..cd459d83e 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -5,7 +5,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_controller.rb,v 1.14 2008-05-12 10:21:34 francis Exp $ +# $Id: track_controller.rb,v 1.15 2008-05-12 10:57:43 francis Exp $ class TrackController < ApplicationController @@ -68,6 +68,21 @@ class TrackController < ApplicationController end end + # Track a user + def track_user + @track_user = User.find_by_url_name(params[:url_name]) + @track_thing = TrackThing.create_track_for_user(@track_user) + ret = self.track_set + if ret + if @track_thing.track_medium == 'feed' + redirect_to :controller => 'track', :action => 'atom_feed', :track_id => @track_thing.id + else + flash[:notice] = "You are " + ret + " tracking this person!" + redirect_to user_url(@track_user) + end + end + end + # Generic request tracker - set @track_thing before calling def track_set diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 5e6d5ba3a..73fbce9d6 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.45 2008-03-25 17:25:09 francis Exp $ +# $Id: user_controller.rb,v 1.46 2008-05-12 10:57:43 francis Exp $ class UserController < ApplicationController # Show page about a set of users with same url name @@ -21,6 +21,9 @@ class UserController < ApplicationController @same_name_users = User.find(:all, :conditions => [ "name = ? and email_confirmed and id <> ?", @display_user.name, @display_user.id ], :order => "created_at") @is_you = !@user.nil? && @user.id == @display_user.id + + # Track corresponding to this page + @track_thing = TrackThing.create_track_for_user(@display_user) end # Login form |