diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/general_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/track_controller.rb | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 3c94940dd..aafd76ff3 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_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: general_controller.rb,v 1.23 2008-05-15 17:40:43 francis Exp $ +# $Id: general_controller.rb,v 1.24 2008-05-15 22:47:16 francis Exp $ class GeneralController < ApplicationController @@ -73,6 +73,8 @@ class GeneralController < ApplicationController # Spelling and highight words are same for all three queries @spelling_correction = @xapian_requests.spelling_correction @highlight_words = @xapian_requests.words_to_highlight + + @track_thing = TrackThing.create_track_for_search_query(query) end # For debugging diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 7f0553a34..b37afc6d5 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.17 2008-05-15 17:40:43 francis Exp $ +# $Id: track_controller.rb,v 1.18 2008-05-15 22:47:16 francis Exp $ class TrackController < ApplicationController @@ -95,6 +95,22 @@ class TrackController < ApplicationController end end + # Track a search term + def track_search_query + @query = params[:query] + @track_thing = TrackThing.create_track_for_search_query(@query) + 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 the search '" + CGI.escapeHTML(@query) + "' !" + redirect_to user_url(@track_user) + end + end + end + + # Generic request tracker - set @track_thing before calling def track_set |