diff options
author | David Cabo <david@calibea.com> | 2012-05-28 12:58:02 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2012-05-28 12:58:02 +0200 |
commit | bc681f7270f5ddc40279981a15a0a7c7af250293 (patch) | |
tree | 5df68fe9a0a756d9821c560079271ed363bd3f18 /app/controllers/track_controller.rb | |
parent | ba29eab41f51f3f489be7c5daf6d28449eab944f (diff) | |
parent | acde8a57e087d3058b8539e04c12e790866f8451 (diff) |
Merge branch 'develop' of github.com:sebbacon/alaveteli into develop
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r-- | app/controllers/track_controller.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index d858ab233..312cedc6c 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -50,11 +50,15 @@ class TrackController < ApplicationController raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil? # If found by historic name, or alternate locale name, redirect to new name if @public_body.url_name != params[:url_name] - redirect_to track_public_body_url(:url_name => @public_body.url_name, :feed => params[:feed]) + redirect_to track_public_body_url(:url_name => @public_body.url_name, :feed => params[:feed], :event_type => params[:event_type]) return end - @track_thing = TrackThing.create_track_for_public_body(@public_body) + if params[:event_type] + @track_thing = TrackThing.create_track_for_public_body(@public_body, params[:event_type]) + else + @track_thing = TrackThing.create_track_for_public_body(@public_body) + end return atom_feed_internal if params[:feed] == 'feed' @@ -94,7 +98,23 @@ class TrackController < ApplicationController return atom_feed_internal if params[:feed] == 'feed' if self.track_set - redirect_to search_url(@query) + if @query.scan("variety").length == 1 + # we're making a track for a simple filter, for which + # there's an expression in the UI (rather than relying + # on index:value strings in the query) + if @query =~ /variety:user/ + postfix = "users" + @query.sub!("variety:user", "") + elsif @query =~ /variety:authority/ + postfix = "bodies" + @query.sub!("variety:authority", "") + elsif @query =~ /variety:sent/ + postfix = "requests" + @query.sub!("variety:sent", "") + end + @query.strip! + end + redirect_to search_url([@query, postfix]) end end |