diff options
-rw-r--r-- | app/controllers/file_request_controller.rb | 5 | ||||
-rw-r--r-- | app/models/info_request.rb | 5 | ||||
-rw-r--r-- | app/models/public_body.rb | 4 | ||||
-rw-r--r-- | app/views/admin_public_body/_form.rhtml | 2 | ||||
-rw-r--r-- | app/views/file_request/index.rhtml | 39 | ||||
-rw-r--r-- | db/schema.rb | 7 | ||||
-rw-r--r-- | public/stylesheets/main.css | 42 | ||||
-rw-r--r-- | todo.txt | 7 |
8 files changed, 46 insertions, 65 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"> </label> + <%= submit_tag "Create request >>" %> </p> </div> diff --git a/db/schema.rb b/db/schema.rb index 8d159eae6..08043cd76 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,11 +2,12 @@ # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. -ActiveRecord::Schema.define(:version => 7) do +ActiveRecord::Schema.define(:version => 8) do create_table "info_requests", :force => true do |t| - t.column "title", :text - t.column "user_id", :integer + t.column "title", :text + t.column "user_id", :integer + t.column "public_body_id", :integer end create_table "public_bodies", :force => true do |t| diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index f7e80e708..f5b8b76b8 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -26,6 +26,11 @@ a:hover, a:active { form { margin: 0; + + padding: 1em; + background-color: #97E300; + -moz-border-radius: 1em; + border-radius: 1em; } select, input, textarea { @@ -36,7 +41,7 @@ label { float: left; text-align: right; padding-right: 0.5em; - width: 5em; + width: 10em; } /* Flashes */ @@ -58,6 +63,13 @@ label { border: solid 1px #00cc00; } +/* Form error highlighting */ + +.fieldWithErrors input, .fieldWithErrors input[type=text], .fieldWithErrors select, .fieldWithErrors input[type=radio]{ + border: solid 1px #cc0000; + background-color: #ffcccc; +} + /* Site-wide layout */ #header { @@ -138,24 +150,6 @@ label { #writeForm { float: right; - text-align: center; - margin: 1em auto; - margin-right: 2em; - padding: 1em; - background-color: #97E300; - -moz-border-radius: 1em; - border-radius: 1em; -} - -#writeForm label { - float: left; - text-align: right; - padding-right: 0; - display: block; -} - -#writeForm #submit { - font-size: 83%; } #writeForm #address_part { @@ -164,15 +158,7 @@ label { } #writeForm #message_part { - float: left; - clear: both; -} - -/* Forms */ - -.fieldWithErrors input, .fieldWithErrors input[type=text], .fieldWithErrors select, .fieldWithErrors input[type=radio]{ - border: solid 1px #cc0000; - background-color: #ffcccc; + float: right; } @@ -1,9 +1,12 @@ Redirect the front page to the new FOI request page +Make it say "dear" as default letter -Just use crappy login and get on with it :( +Tidying +======= +Rename file_request to new ? +Add foreign keys to database -Rename file_requet to new ? |