aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/file_request_controller.rb5
-rw-r--r--app/models/info_request.rb5
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/views/admin_public_body/_form.rhtml2
-rw-r--r--app/views/file_request/index.rhtml39
5 files changed, 23 insertions, 32 deletions
diff --git a/app/controllers/file_request_controller.rb b/app/controllers/file_request_controller.rb
index b96a87b8b..f062f0da8 100644
--- a/app/controllers/file_request_controller.rb
+++ b/app/controllers/file_request_controller.rb
@@ -4,13 +4,16 @@
# 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.3 2007-08-23 17:39:42 francis Exp $
+# $Id: file_request_controller.rb,v 1.4 2007-09-10 01:16:35 francis Exp $
class FileRequestController < ApplicationController
def index
end
def create
+# raise params[:info_request][:public_body_id]
+# params[:info_request][:public_body] = PublicBody.find(params[:info_request][:public_body_id])
+# params[:info_request].delete(:public_body_id)
@info_request = InfoRequest.new(params[:info_request])
if not @info_request.save
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index f79bf1dca..21f9e47cb 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -4,13 +4,16 @@
# 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.2 2007-08-21 11:33:45 francis Exp $
+# $Id: info_request.rb,v 1.3 2007-09-10 01:16:35 francis Exp $
class InfoRequest < ActiveRecord::Base
belongs_to :user
+ belongs_to :public_body
# validates_presence_of :user
# validates_numericality_of :user
validates_presence_of :title
+ validates_presence_of :public_body_id
+
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 0498e3688..c2c270e6b 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -4,11 +4,13 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.4 2007-08-31 17:56:01 francis Exp $
+# $Id: public_body.rb,v 1.5 2007-09-10 01:16:35 francis Exp $
class PublicBody < ActiveRecord::Base
validates_presence_of :request_email
+ has_many :info_request
+
def validate
unless MySociety::Validate.is_valid_email(request_email)
errors.add(:request_email, "doesn't look like a valid email address")
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index 0c2576bc3..dda975d14 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -12,7 +12,7 @@
<p><label for="public_body_complaint_email">Complaint email</label><br/>
<%= text_field 'public_body', 'complaint_email', :size => 40 %></p>
-<p><label for="public_body_last_edit_comment">Edit comment</label><br/>
+<p><label for="public_body_last_edit_comment">Comment for this edit</label> (put URL or other source of new info)<br/>
<%= text_area 'public_body', 'last_edit_comment', :rows => 3, :cols => 60 %></p>
<!--[eoform:public_body]-->
diff --git a/app/views/file_request/index.rhtml b/app/views/file_request/index.rhtml
index acf7a5890..8e4955463 100644
--- a/app/views/file_request/index.rhtml
+++ b/app/views/file_request/index.rhtml
@@ -6,51 +6,34 @@
<h1>New FOI request</h1>
- <p>All information that you enter, except for your email address, will be
-displayed publically on this website.</p>
-
- <div id="address_part">
+ <p><strong>Privacy warning:</strong> All information that you enter, except
+ for your email address, will be displayed publically on this website.</p>
<p>
- <label for="public_body">Public body:</label>
+ <label for="public_body_id">Public body:</label>
<%=
@public_bodies = PublicBody.find(:all, :order => "name")
- f.collection_select(:public_body, @public_bodies, :id, :name)
+ f.collection_select(:public_body_id, @public_bodies, :id, :name)
%>
</p>
- <% fields_for :user do |u| %>
- <p>
- <label for="user_name">Your name:</label>
- <%= u.text_field :name, "size" => 20 %>
- <!-- (will be displayed on this site with your request and any response)<br /> -->
- </p>
-
- <p>
- <label for="user_email">Email:</label>
- <%= u.text_field :email, "size" => 20 %>
- <!-- (we'll only use it to keep you up to date about your request, and this site) -->
- </p>
- <% end %>
-
- </div>
-
- <div id="message_part">
<p>
- <label for="info_request_title">Title:</label>
- <%= f.text_field :title, "size" => 50 %>
-<!-- (a one line summary of the information you are requesting, e.g. 'Crime statistics by ward level for Wales') -->
+ <label for="info_request_title">Summary:</label>
+ <%= f.text_field :title, :size => 50 %>
+ <br>(a one line summary of the information you are requesting, e.g. 'Crime statistics by ward level for Wales')
</p>
<% fields_for :outgoing_message do |o| %>
<p>
- <%= o.text_area :body %>
+ <label for="outgoing_message_body">Your letter:</label>
+ <%= o.text_area :body, :rows => 20, :cols => 60 %>
</p>
<% end %>
<p>
- <%= submit_tag "Create" %>
+ <label for="commit">&nbsp;</label>
+ <%= submit_tag "Create request >>" %>
</p>
</div>