aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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
3 files changed, 52 insertions, 3 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>
+
+
+
+