aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application.rb7
-rw-r--r--app/controllers/list_controller.rb15
-rw-r--r--app/controllers/new_controller.rb3
3 files changed, 23 insertions, 2 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index a230262cd..f681b46c8 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: application.rb,v 1.9 2007-10-03 20:01:45 louise Exp $
+# $Id: application.rb,v 1.10 2007-10-08 15:16:22 francis Exp $
class ApplicationController < ActionController::Base
@@ -82,6 +82,11 @@ class ApplicationController < ActionController::Base
return true
end
+ # Return logged in user
+ def authenticated_user
+ return User.find(session[:user])
+ end
+
# For redirects to POST requests
before_filter :post_redirect
def post_redirect
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb
new file mode 100644
index 000000000..16a0d0695
--- /dev/null
+++ b/app/controllers/list_controller.rb
@@ -0,0 +1,15 @@
+# app/controllers/list_controller.rb:
+# Show all of the FOI requests in the system.
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: list_controller.rb,v 1.1 2007-10-08 15:16:22 francis Exp $
+
+
+class ListController < ApplicationController
+
+ def index
+ @info_request_pages, @info_requests = paginate :info_requests, :per_page => 25
+ end
+end
diff --git a/app/controllers/new_controller.rb b/app/controllers/new_controller.rb
index 1952ace06..175393502 100644
--- a/app/controllers/new_controller.rb
+++ b/app/controllers/new_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: new_controller.rb,v 1.1 2007-10-08 14:58:27 francis Exp $
+# $Id: new_controller.rb,v 1.2 2007-10-08 15:16:22 francis Exp $
class NewController < ApplicationController
def index
@@ -25,6 +25,7 @@ class NewController < ApplicationController
if not @info_request.valid?
render :action => 'index'
elsif check_authentication
+ @info_request.user = authenticated_user
@info_request.save
end