aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb4
-rw-r--r--app/controllers/track_controller.rb25
-rw-r--r--app/helpers/link_to_helper.rb6
-rw-r--r--app/models/track_thing.rb33
4 files changed, 55 insertions, 13 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index a4d8beba6..719fd68e8 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_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: request_controller.rb,v 1.82 2008-05-12 08:35:24 francis Exp $
+# $Id: request_controller.rb,v 1.83 2008-05-12 09:18:45 francis Exp $
class RequestController < ApplicationController
@@ -51,12 +51,12 @@ class RequestController < ApplicationController
@title = "Recently sent Freedom of Information requests"
query = "variety:sent";
sortby = "newest"
- # Track corresponding to this page
@track_thing = TrackThing.create_track_for_all_new_requests
elsif @view == 'successful'
@title = "Recent successful responses"
query = 'variety:response (status:successful OR status:partially_successful)'
sortby = "newest"
+ @track_thing = TrackThing.create_track_for_all_successful_requests
else
raise "unknown request list view " + @view.to_s
end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index a1845b3f0..7b6244bc6 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.12 2008-05-12 01:59:01 francis Exp $
+# $Id: track_controller.rb,v 1.13 2008-05-12 09:18:45 francis Exp $
class TrackController < ApplicationController
@@ -25,15 +25,30 @@ class TrackController < ApplicationController
end
# Track all new requests
- def track_new_requests
- @track_thing = TrackThing.create_track_for_all_new_requests
+ def track_list
+ @view = params[:view]
+
+ if @view.nil?
+ @track_thing = TrackThing.create_track_for_all_new_requests
+ elsif @view == 'successful'
+ @track_thing = TrackThing.create_track_for_all_successful_requests
+ else
+ raise "unknown request list view " + @view.to_s
+ end
+
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 + " being told about any new requests!"
- redirect_to request_list_url(:view => nil)
+ if @view.nil?
+ flash[:notice] = "You are " + ret + " being told about any new requests!"
+ elsif @view == 'successful'
+ flash[:notice] = "You are " + ret + " being told about any successful requests!"
+ else
+ raise "unknown request list view " + @view.to_s
+ end
+ redirect_to request_list_url(:view => @view)
end
end
end
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 75b2a9589..e3e88d8ee 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.27 2008-05-12 08:35:25 francis Exp $
+# $Id: link_to_helper.rb,v 1.28 2008-05-12 09:18:45 francis Exp $
module LinkToHelper
@@ -86,7 +86,9 @@ module LinkToHelper
if track_thing.track_type == 'request_updates'
track_request_url(:url_title => track_thing.info_request.url_title)
elsif track_thing.track_type == 'all_new_requests'
- track_new_requests_url
+ track_list_url(:view => nil)
+ elsif track_thing.track_type == 'all_successful_requests'
+ track_list_url(:view => 'successful')
else
raise "unknown tracking type " + track_thing.track_type
end
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index f808856d9..2039912d7 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.14 2008-05-12 08:35:25 francis Exp $
+# $Id: track_thing.rb,v 1.15 2008-05-12 09:18:45 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
@@ -37,6 +37,7 @@ class TrackThing < ActiveRecord::Base
validates_inclusion_of :track_type, :in => [
'request_updates',
'all_new_requests',
+ 'all_successful_requests',
]
validates_inclusion_of :track_medium, :in => [
@@ -52,13 +53,20 @@ class TrackThing < ActiveRecord::Base
return track_thing
end
- def TrackThing.create_track_for_all_new_requests()
+ def TrackThing.create_track_for_all_new_requests
track_thing = TrackThing.new
track_thing.track_type = 'all_new_requests'
track_thing.track_query = "variety:sent"
return track_thing
end
+ def TrackThing.create_track_for_all_successful_requests
+ track_thing = TrackThing.new
+ track_thing.track_type = 'all_successful_requests'
+ track_thing.track_query = 'variety:response (status:successful OR status:partially_successful)'
+ return track_thing
+ end
+
# Return hash of text parameters describing the request etc.
include LinkToHelper
def params
@@ -91,13 +99,30 @@ class TrackThing < ActiveRecord::Base
:title_in_email => "New Freedom of Information requests",
:title_in_rss => "New Freedom of Information requests",
# Authentication
- :web => "To be told about any new requets",
+ :web => "To be told about any new requests",
:email => "Then you will be emailed whenever anyone makes a new FOI request",
:email_subject => "Confirm you want to be emailed about new requests",
# Other
:feed_sortby => 'described', # for RSS, as newest would give a date for responses possibly days before description
}
- else
+ elsif self.track_type == 'all_successful_requests'
+ @params = {
+ # Website
+ :set_title => "How would you like to be told when any request succeeds?",
+ :list_description => "any <a href=\"/list\">successful requests</a>",
+ :verb_on_page => "Be told when any request succeeds",
+ :verb_on_page_already => "being told when any request succeeds",
+ # Email
+ :title_in_email => "Successful Freedom of Information requests",
+ :title_in_rss => "Successful Freedom of Information requests",
+ # Authentication
+ :web => "To be told about any successful requests",
+ :email => "Then you will be emailed whenever an FOI request succeeds",
+ :email_subject => "Confirm you want to be emailed when an FOI request succeeds",
+ # Other
+ :feed_sortby => 'described', # for RSS, as successfulest would give a date for responses possibly days before description
+ }
+ else
raise "unknown tracking type " + self.track_type
end
end