aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb7
-rw-r--r--app/controllers/request_game_controller.rb28
-rw-r--r--app/views/request_game/play.rhtml20
-rw-r--r--config/routes.rb7
4 files changed, 58 insertions, 4 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index f413d7320..ea0fb7058 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.158 2009-04-23 13:32:21 tony Exp $
+# $Id: request_controller.rb,v 1.159 2009-05-11 13:06:33 tony Exp $
class RequestController < ApplicationController
@@ -287,16 +287,17 @@ class RequestController < ApplicationController
})
end
+ # TODO harmonise the next two methods?
if User.owns_every_request?(authenticated_user)
flash[:notice] = '<p>The request status has been updated</p>'
- redirect_to request_url(@info_request)
+ redirect_to session[:request_game] ? play_url : request_url(@info_request)
return
end
if @old_unclassified && !@is_owning_user
flash[:notice] = '<p>Thank you for updating this request!</p>'
RequestMailer.deliver_old_unclassified_updated(@info_request)
- redirect_to request_url(@info_request)
+ redirect_to session[:request_game] ? play_url : request_url(@info_request)
return
end
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
new file mode 100644
index 000000000..1be26e5a1
--- /dev/null
+++ b/app/controllers/request_game_controller.rb
@@ -0,0 +1,28 @@
+# app/controllers/request_game_controller.rb:
+# The 'categorise old requests' game
+#
+# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: request_game_controller.rb,v 1.1 2009-05-11 13:06:34 tony Exp $
+
+class RequestGameController < ApplicationController
+
+ def play
+ # XXX make sure they're logged in
+ session[:request_game] = Time.now
+
+ old = InfoRequest.find_old_unclassified(:conditions => ["prominence != 'backpage'"], :age_in_days => 10)
+ @missing = old.size
+ @requests = old.sort_by{ rand }.slice(0..2)
+ end
+
+ # Requests similar to this one
+ def stop
+ session[:request_game] = nil
+ flash[:notice] = 'Thank you for helping us keep the site tidy!'
+ redirect_to frontpage_url
+ end
+
+end
+
diff --git a/app/views/request_game/play.rhtml b/app/views/request_game/play.rhtml
new file mode 100644
index 000000000..393e0b0b6
--- /dev/null
+++ b/app/views/request_game/play.rhtml
@@ -0,0 +1,20 @@
+
+<h2>Help Us!</h2>
+
+<p>Hi! We need your help. We have <%= @missing %> requests where the person who
+made them hasn't told us whether or not they were successful. We would
+be exceedingly grateful if you could choose one of these requests, read
+it, and let everyone know whether or not the information has been
+provided.</p>
+
+<%= render :partial => 'request/request_listing', :locals => { :info_requests => @requests } %>
+
+<hr />
+<ul>
+ <li><%= link_to "I don't like these ones &mdash; give me some more!", play_url %></li>
+ <li><%= link_to "I don't want to do any more tidying now!", stop_url %></li>
+</ul>
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 18c6406c1..788ce8afc 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.86 2009-04-14 14:51:00 tony Exp $
+# $Id: routes.rb,v 1.87 2009-05-11 13:06:34 tony Exp $
ActionController::Routing::Routes.draw do |map|
@@ -93,6 +93,11 @@ ActionController::Routing::Routes.draw do |map|
holiday.due_date "/due_date/:holiday", :action => 'due_date'
end
+ map.with_options :controller => 'request_game' do |game|
+ game.play "/categorise/play", :action => 'play'
+ game.stop "/categorise/stop", :action => 'stop'
+ end
+
# NB: We don't use routes to *construct* admin URLs, as they need to be relative
# paths to work on the live site proxied over HTTPS to secure.mysociety.org
map.connect '/admin/', :controller => 'admin_general', :action => 'index'