aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application.rb23
-rw-r--r--app/controllers/file_request_controller.rb25
-rw-r--r--app/controllers/frontpage_controller.rb4
-rw-r--r--app/helpers/file_request_helper.rb2
-rw-r--r--app/models/info_request.rb13
-rw-r--r--app/models/user.rb4
-rw-r--r--app/views/file_request/index.rhtml33
-rw-r--r--app/views/frontpage/index.rhtml2
-rw-r--r--app/views/layouts/default.rhtml2
9 files changed, 93 insertions, 15 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index 4365de88d..ddd6e86b4 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -6,21 +6,16 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: application.rb,v 1.3 2007-08-01 17:06:04 francis Exp $
+# $Id: application.rb,v 1.4 2007-08-04 11:10:25 francis Exp $
class ApplicationController < ActionController::Base
+ # Standard hearders, footers and navigation for whole site
+ layout "default"
+
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_foi_session_id'
- def check_authentication
- unless session[:user]
- session[:intended_action] = action_name
- session[:intended_controller] = controller_name
- redirect_to :action => "signin"
- end
- end
-
def signin
if request.post?
user = User.authenticate(params[:email], params[:password])
@@ -39,4 +34,14 @@ class ApplicationController < ActionController::Base
redirect_to frontpage
end
+ private
+
+ def check_authentication
+ unless session[:user]
+ session[:intended_action] = action_name
+ session[:intended_controller] = controller_name
+ redirect_to :action => "signin"
+ end
+ end
+
end
diff --git a/app/controllers/file_request_controller.rb b/app/controllers/file_request_controller.rb
new file mode 100644
index 000000000..9b0f7c403
--- /dev/null
+++ b/app/controllers/file_request_controller.rb
@@ -0,0 +1,25 @@
+# app/controllers/file_request_controller.rb:
+# Interface for building a new FOI request.
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: file_request_controller.rb,v 1.1 2007-08-04 11:10:25 francis Exp $
+
+class FileRequestController < ApplicationController
+ def index
+ respond_to do |format|
+ format.html
+ end
+ end
+
+ def create
+ respond_to do |format|
+ format.html
+ end
+ end
+
+
+end
+
+
diff --git a/app/controllers/frontpage_controller.rb b/app/controllers/frontpage_controller.rb
index 16aaaf4c3..36d31d2f5 100644
--- a/app/controllers/frontpage_controller.rb
+++ b/app/controllers/frontpage_controller.rb
@@ -4,11 +4,9 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: frontpage_controller.rb,v 1.3 2007-08-03 16:14:58 francis Exp $
+# $Id: frontpage_controller.rb,v 1.4 2007-08-04 11:10:25 francis Exp $
class FrontpageController < ApplicationController
- layout "default"
-
def index
respond_to do |format|
format.html
diff --git a/app/helpers/file_request_helper.rb b/app/helpers/file_request_helper.rb
new file mode 100644
index 000000000..fc398dab7
--- /dev/null
+++ b/app/helpers/file_request_helper.rb
@@ -0,0 +1,2 @@
+module FileRequestHelper
+end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
new file mode 100644
index 000000000..9c84263bf
--- /dev/null
+++ b/app/models/info_request.rb
@@ -0,0 +1,13 @@
+# models/info_request.rb:
+# A Freedom of Information request.
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: info_request.rb,v 1.1 2007-08-04 11:10:26 francis Exp $
+
+class InfoRequest < ActiveRecord::Base
+ belongs_to :user
+
+end
+
diff --git a/app/models/user.rb b/app/models/user.rb
index 2a6b7a31d..a333e5721 100644
--- a/app/models/user.rb
+++ b/app/models/user.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: user.rb,v 1.1 2007-08-01 16:41:33 francis Exp $
+# $Id: user.rb,v 1.2 2007-08-04 11:10:26 francis Exp $
require 'digest/sha1'
@@ -14,6 +14,8 @@ class User < ActiveRecord::Base
validates_presence_of :email
validates_uniqueness_of :email, :case_sensitive => false
+ has_many :user
+
attr_accessor :password_confirmation
validates_confirmation_of :password
diff --git a/app/views/file_request/index.rhtml b/app/views/file_request/index.rhtml
new file mode 100644
index 000000000..3b03b987f
--- /dev/null
+++ b/app/views/file_request/index.rhtml
@@ -0,0 +1,33 @@
+<h1>New request</h1>
+
+<% form_for(:foi_request, @foi_request, :url => { :action => :create }, :html => { :id => 'writeForm' } ) do |f| %>
+ <%= error_messages_for :foi_request %>
+
+ <% fields_for :user do |u| %>
+ <p>
+ <b>Your name</b> (will be displayed on this site with your request and any response)<br />
+ <%= u.text_field :name %>
+ </p>
+
+ <p>
+ <b>Your email</b> (we'll only use it to keep you up to date about your request, and this site)<br />
+ <%= u.text_field :email %>
+ </p>
+ <% end %>
+
+ <p>
+ <b>Request title</b><br />
+ <%= f.text_field :title, "size" => 30 %>
+ </p>
+
+ <p>
+ <b>Letter</b><br />
+ <%= f.text_area :body %>
+ </p>
+
+ <p>
+ <%= submit_tag "Create" %>
+ </p>
+<% end %>
+
+
diff --git a/app/views/frontpage/index.rhtml b/app/views/frontpage/index.rhtml
index f5cf1fcbb..8b5611d41 100644
--- a/app/views/frontpage/index.rhtml
+++ b/app/views/frontpage/index.rhtml
@@ -1,3 +1,3 @@
-<p>Make requests for information from the UK Government.
+<p id="explanation">Make requests for information from the UK Government
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 662c9a5aa..7eb81f3ec 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -7,7 +7,7 @@
<!-- <link rel="alternate" type="application/rss+xml" title="" href=""> -->
</head>
<body>
- <h1 id="header">Freedom <span id="my">of Information</span> Archive <span id="beta">Beta</span></h1>
+ <h1 id="header">Freedom of Information Filer and Archive <span id="beta">Beta</span></h1>
<ul id="navigation">
<li>Home</li>
</ul>