diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/body_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/track_controller.rb | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb index 3441a8db5..866cfa8aa 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/body_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: body_controller.rb,v 1.11 2008-03-28 15:09:47 francis Exp $ +# $Id: body_controller.rb,v 1.12 2008-05-12 10:21:34 francis Exp $ class BodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -32,6 +32,8 @@ class BodyController < ApplicationController redirect_to show_public_body_url(:url_name => @public_bodies[0].url_name) end @public_body = @public_bodies[0] + + @track_thing = TrackThing.create_track_for_public_body(@public_body) end def list diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 7b6244bc6..970b2a52a 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.13 2008-05-12 09:18:45 francis Exp $ +# $Id: track_controller.rb,v 1.14 2008-05-12 10:21:34 francis Exp $ class TrackController < ApplicationController @@ -24,7 +24,7 @@ class TrackController < ApplicationController end end - # Track all new requests + # Track all new/successful requests def track_list @view = params[:view] @@ -53,6 +53,22 @@ class TrackController < ApplicationController end end + # Track all updates to a particular public body + def track_public_body + @public_body = PublicBody.find_by_url_name(params[:url_name]) + @track_thing = TrackThing.create_track_for_public_body(@public_body) + 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 public body!" + redirect_to public_body_url(@public_body) + end + end + end + + # Generic request tracker - set @track_thing before calling def track_set if @user |