diff options
-rw-r--r-- | app/controllers/request_controller.rb | 15 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 15 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 5 | ||||
-rw-r--r-- | app/views/request/preview.rhtml | 32 | ||||
-rw-r--r-- | public/stylesheets/main.css | 16 | ||||
-rw-r--r-- | todo.txt | 4 |
6 files changed, 78 insertions, 9 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 60d12e68d..3d7e1c869 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.58 2008-02-22 13:26:36 francis Exp $ +# $Id: request_controller.rb,v 1.59 2008-02-25 11:17:29 francis Exp $ class RequestController < ApplicationController @@ -53,7 +53,7 @@ class RequestController < ApplicationController # Page new form posts to def new # First time we get to the page, just display it - if params[:submitted_new_request].nil? + if params[:submitted_new_request].nil? or params[:reedit] # Read parameters in - public body can be passed from front page if params[:public_body_id] params[:info_request] = { :public_body_id => params[:public_body_id] } @@ -90,7 +90,16 @@ class RequestController < ApplicationController # will be valid for a specific reason which we are displaying anyway. @info_request.errors.delete("outgoing_messages") render :action => 'new' - elsif authenticated?( + return + end + + # Show preview page, if it is a preview + if params[:preview].to_i == 1 + render :action => 'preview' + return + end + + if authenticated?( :web => "To send your FOI request", :email => "Then your FOI request to " + @info_request.public_body.name + " will be sent.", :email_subject => "Confirm your FOI request to " + @info_request.public_body.name diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 519c0be94..9c76bc03f 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: outgoing_message.rb,v 1.29 2008-02-21 20:45:51 francis Exp $ +# $Id: outgoing_message.rb,v 1.30 2008-02-25 11:17:29 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request @@ -124,7 +124,18 @@ class OutgoingMessage < ActiveRecord::Base # Return body for display as HTML def get_body_for_html_display - text = body + text = self.body + text = MySociety::Format.make_clickable(text, :contract => 1) + text = text.gsub(/\n/, '<br>') + + return text + end + + # Return body for display as HTML + # XXX this is repeating code in a combination of + # views/layouts/request_mailer.rhtml and views/request_mailer/initial_request.rhtml + def get_body_for_html_preview + text = MySociety::Format.wrap_email_body(self.body.strip) text = MySociety::Format.make_clickable(text, :contract => 1) text = text.gsub(/\n/, '<br>') diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 18f719264..2bf80eb1b 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -69,8 +69,9 @@ <div class="form_button"> <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> - <%= hidden_field_tag(:submitted_new_request, { :value => 1 } ) %> - <%= submit_tag "Make public Freedom of Information request >>" %> + <%= hidden_field_tag(:submitted_new_request, 1 ) %> + <%= hidden_field_tag(:preview, 1 ) %> + <%= submit_tag "Preview your public request" %> </div> <% end %> diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml new file mode 100644 index 000000000..7104d65a5 --- /dev/null +++ b/app/views/request/preview.rhtml @@ -0,0 +1,32 @@ +<% @title = "Preview new FOI request to '" + h(@info_request.public_body.name) + "'" %> + +<% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %> + + <h1>Preview your request</h1> + + <%= f.hidden_field(:title) %> + + <% fields_for :outgoing_message do |o| %> + <p class="outgoing_message_preview"> + <strong>To:</strong> <%=h @info_request.public_body.name %> + <br><strong>Subject:</strong> <%=h @info_request.title %> + <br><br> + <%= @outgoing_message.get_body_for_html_preview %> + <%= o.hidden_field(:body) %> + </p> + <% end %> + + <strong>Note:</strong> Your request and any response will be + displayed publically on this website. + + <p> + <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <%= hidden_field_tag(:submitted_new_request, 1) %> + <%= hidden_field_tag(:preview, 0 ) %> + <%= submit_tag "Re-edit this request", :name => 'reedit' %> + <%= submit_tag "Send Freedom of Information request", :name => 'submit' %> + </p> + +<% end %> + + diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 3e2545a98..f1ed00ca8 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -48,7 +48,7 @@ a:active { background-color: #c7eb6e; /* Richard: 006aa2, c35b00, 613000 */ /* Richard: 151517, a72d22, c3d42c */ - /* Tom: how about block heading C7EB6E , heading edge 79B837 and title text 0A0A0A */ + /* Tom: how about block heading c7eb6e , heading edge 79b837 and title text 0a0a0a */ color: #000000; } @@ -293,7 +293,7 @@ div.auto_complete ul strong.highlight { /* /new - submitting requests */ #write_form { - float: right; + float: center; margin-bottom: 1em; } @@ -315,6 +315,18 @@ div.auto_complete ul strong.highlight { font-weight: bold; } +#preview_form { + float: center; + margin-left: 8em; +} + +#preview_form .outgoing_message_preview { + width: 75%; + background-color: #c7eb6e; + border: solid 1px #79b837; + padding: 1em; +} + /* /list - browsing requests */ table#list_requests { @@ -13,6 +13,10 @@ BAILII - relationship with law courts, robots.txt ? Next ==== +Search and replace text "FOI" and "Freedom of Information" out the way more + +hidden_field_tags are all wrong - they store value1 x + Adam's woes: http://foi.mysociety.org/request/18/response/31 - No doubt leaks email address via download.bin :( |