diff options
-rw-r--r-- | app/controllers/track_controller.rb | 24 | ||||
-rw-r--r-- | app/helpers/link_to_helper.rb | 18 | ||||
-rw-r--r-- | app/views/track/_tracking_people_and_link.rhtml | 2 | ||||
-rw-r--r-- | config/routes.rb | 14 | ||||
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 8 | ||||
-rw-r--r-- | todo.txt | 19 |
6 files changed, 55 insertions, 30 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index b010a5798..11975b725 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.22 2008-05-27 11:16:05 francis Exp $ +# $Id: track_controller.rb,v 1.23 2008-07-18 22:22:58 francis Exp $ class TrackController < ApplicationController @@ -13,6 +13,9 @@ class TrackController < ApplicationController def track_request @info_request = InfoRequest.find_by_url_title(params[:url_title]) @track_thing = TrackThing.create_track_for_request(@info_request) + + return atom_feed_internal if params[:feed] == 'feed' + ret = self.track_set if ret if @track_thing.track_medium == 'feed' @@ -36,6 +39,8 @@ class TrackController < ApplicationController raise "unknown request list view " + @view.to_s end + return atom_feed_internal if params[:feed] == 'feed' + ret = self.track_set if ret if @track_thing.track_medium == 'feed' @@ -69,6 +74,9 @@ class TrackController < ApplicationController def track_public_body @public_body = PublicBody.find_by_url_name(params[:url_name]) @track_thing = TrackThing.create_track_for_public_body(@public_body) + + return atom_feed_internal if params[:feed] == 'feed' + ret = self.track_set if ret if @track_thing.track_medium == 'feed' @@ -84,6 +92,9 @@ class TrackController < ApplicationController def track_user @track_user = User.find_by_url_name(params[:url_name]) @track_thing = TrackThing.create_track_for_user(@track_user) + + return atom_feed_internal if params[:feed] == 'feed' + ret = self.track_set if ret if @track_thing.track_medium == 'feed' @@ -101,8 +112,10 @@ class TrackController < ApplicationController # join just to get / and . to work in a query. query_array = params[:query_array] @query = query_array.join("/") - @track_thing = TrackThing.create_track_for_search_query(@query) + + return atom_feed_internal if params[:feed] + ret = self.track_set if ret if @track_thing.track_medium == 'feed' @@ -150,8 +163,13 @@ class TrackController < ApplicationController # Atom feed (like RSS) for the track def atom_feed @track_thing = TrackThing.find(params[:track_id].to_i) + atom_feed_internal + end + def atom_feed_internal @xapian_object = perform_search([InfoRequestEvent], @track_thing.track_query, @track_thing.params[:feed_sortby], nil, 25, 1) - respond_to :atom + respond_to do |format| + format.atom { render :template => 'track/atom_feed' } + end end # Change or delete a track diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 1603e9ad3..d78ca26d7 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.33 2008-07-09 07:23:32 francis Exp $ +# $Id: link_to_helper.rb,v 1.34 2008-07-18 22:22:58 francis Exp $ module LinkToHelper @@ -84,20 +84,20 @@ module LinkToHelper link_to h(user.name), user_admin_url(user) end - # Teacks - def do_track_url(track_thing) + # Tracks. feed can be 'track' or 'feed' + def do_track_url(track_thing, feed = 'track') if track_thing.track_type == 'request_updates' - track_request_url(:url_title => track_thing.info_request.url_title) + track_request_url(:url_title => track_thing.info_request.url_title, :feed => feed) elsif track_thing.track_type == 'all_new_requests' - track_list_url(:view => nil) + track_list_url(:view => nil, :feed => feed) elsif track_thing.track_type == 'all_successful_requests' - track_list_url(:view => 'successful') + track_list_url(:view => 'successful', :feed => feed) elsif track_thing.track_type == 'public_body_updates' - track_public_body_url(:url_name => track_thing.public_body.url_name) + track_public_body_url(:url_name => track_thing.public_body.url_name, :feed => feed) elsif track_thing.track_type == 'user_updates' - track_user_url(:url_name => track_thing.tracked_user.url_name) + track_user_url(:url_name => track_thing.tracked_user.url_name, :feed => feed) elsif track_thing.track_type == 'search_query' - track_search_url(track_thing.track_query) + track_search_url(track_thing.track_query, :feed => feed) else raise "unknown tracking type " + track_thing.track_type end diff --git a/app/views/track/_tracking_people_and_link.rhtml b/app/views/track/_tracking_people_and_link.rhtml index c33620f67..fb59ca85c 100644 --- a/app/views/track/_tracking_people_and_link.rhtml +++ b/app/views/track/_tracking_people_and_link.rhtml @@ -40,4 +40,6 @@ <% end %> <% end %> +<!-- <p><%= link_to '<img src="/images/feed-14.png" alt="" class="rss"> RSS feed', do_track_url(track_thing, 'feed') %></p> --> + diff --git a/config/routes.rb b/config/routes.rb index 90825ac50..6d26afeea 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.65 2008-05-27 11:16:05 francis Exp $ +# $Id: routes.rb,v 1.66 2008-07-18 22:22:59 francis Exp $ ActionController::Routing::Routes.draw do |map| @@ -62,12 +62,14 @@ ActionController::Routing::Routes.draw do |map| end map.with_options :controller => 'track' do |track| - track.track_request 'track/request/:url_title', :action => 'track_request' - track.track_list '/track/list/:view', :action => 'track_list', :view => nil - track.track_public_body "/track/body/:url_name", :action => 'track_public_body' - track.track_user "/track/user/:url_name", :action => 'track_user' + # /track/ is for setting up an email alert for the item + # /feed/ is a direct RSS feed of the item + track.track_request '/:feed/request/:url_title', :action => 'track_request', :feed => /(track|feed)/ + track.track_list '/:feed/list/:view', :action => 'track_list', :view => nil, :feed => /(track|feed)/ + track.track_public_body "/:feed/body/:url_name", :action => 'track_public_body', :feed => /(track|feed)/ + track.track_user "/:feed/user/:url_name", :action => 'track_user', :feed => /(track|feed)/ # XXX must be better way of getting dots and slashes in search queries to work than this *query_array - track.track_search "/track/search/*query_array", :action => 'track_search_query' + track.track_search "/:feed/search/*query_array", :action => 'track_search_query' , :feed => /(track|feed)/ track.update '/track/update/:track_id', :action => 'update' track.atom_feed '/track/feed/:track_id', :action => 'atom_feed' diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 62f3a0140..8cf11fde0 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -5,18 +5,18 @@ describe TrackController, "when making a new track on a request" do fixtures :info_requests, :outgoing_messages, :incoming_messages, :info_request_events, :users it "should render with 'track_set' template" do - get :track_request, :url_title => info_requests(:fancy_dog_request).url_title + get :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track' response.should render_template('track_set') end it "should assign the title" do - get :track_request, :url_title => info_requests(:fancy_dog_request).url_title + get :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track' assigns[:title].should include("track the request") end it "should require login when making new track" do - post :track_request, :url_title => info_requests(:fancy_dog_request).url_title, + post :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track', :track_thing => { :track_medium => "email_daily" }, :submitted_track => 1 post_redirect = PostRedirect.get_last_post_redirect @@ -26,7 +26,7 @@ describe TrackController, "when making a new track on a request" do it "should make track and redirect if you are logged in " do TrackThing.count.should == 2 session[:user_id] = users(:bob_smith_user).id - post :track_request, :url_title => info_requests(:fancy_dog_request).url_title, + post :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track', :track_thing => { :track_medium => "email_daily" }, :submitted_track => 1 TrackThing.count.should == 3 @@ -1,3 +1,7 @@ +RSS move: + Can remove "if @track_thing.track_medium == 'feed'" bits from track controller + + Site move: Install PostgresSQL 8.3 Move database @@ -31,9 +35,8 @@ Next ==== Clear out all the need admin attention requests -Clear out all the need classifying requests -https://secure.mysociety.org/cvstrac/tktview?tn=1032 +Clear out all the need classifying requests Internal review status/marker? Request withdrawn by user status/marker? @@ -48,12 +51,6 @@ Comments interleaved with body Do something about shared spreadsheet -In sidebar of request - Share this request on Facebook, by email etc. - Email icon here: http://www.guardian.co.uk/news/video/2008/apr/03/mugabe - Simple Digg style "I lke this request" button (doesn't tracking do?) -Show list of popular tracks somewhere (finds most popular requests in a way) - user/show.rhtml sidebar vs. generic sidebar? (ask Tommy) Needs tagline that v. quickly explains what site is on each page There is grey on grey text in header? bad idea? @@ -61,6 +58,12 @@ There is grey on grey text in header? bad idea? Later ===== +In sidebar of request + Share this request on Facebook, by email etc. + Email icon here: http://www.guardian.co.uk/news/video/2008/apr/03/mugabe + Simple Digg style "I lke this request" button (doesn't tracking do?) +Show list of popular tracks somewhere (finds most popular requests in a way) + Advertise WDTK search queries on TWFY Advertise alerts on end pages with WDTK |