aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb12
-rw-r--r--app/models/request_mailer.rb14
-rw-r--r--app/views/request/_followup.rhtml3
-rw-r--r--app/views/request/followup_preview.rhtml41
-rw-r--r--todo.txt5
5 files changed, 67 insertions, 8 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 017e08c5d..217863aa3 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.100 2008-08-31 12:46:15 francis Exp $
+# $Id: request_controller.rb,v 1.101 2008-08-31 16:02:25 francis Exp $
class RequestController < ApplicationController
@@ -293,7 +293,7 @@ class RequestController < ApplicationController
raise sprintf("Incoming message %d does not belong to request %d", @incoming_message.info_request_id, @info_request.id)
end
- if !params[:submitted_followup].nil?
+ if !params[:submitted_followup].nil? && !params[:reedit]
if @info_request.stop_new_responses
flash[:notice] = 'Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="/help/contact">contact us</a> if you really want to send a follow up message.'
else
@@ -301,7 +301,13 @@ class RequestController < ApplicationController
@outgoing_message.info_request = @info_request
if !@outgoing_message.valid?
render :action => 'show_response'
- elsif authenticated_as_user?(@info_request.user,
+ return
+ end
+ if params[:preview].to_i == 1
+ render :action => 'followup_preview'
+ return
+ end
+ if authenticated_as_user?(@info_request.user,
:web => "To send your follow up message about your FOI request",
:email => "Then your follow up message to " + @info_request.public_body.name + " will be sent.",
:email_subject => "Confirm your FOI follow up message to " + @info_request.public_body.name
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index 28371b1ac..eb4d83349 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.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_mailer.rb,v 1.47 2008-08-29 16:54:38 francis Exp $
+# $Id: request_mailer.rb,v 1.48 2008-08-31 16:02:26 francis Exp $
class RequestMailer < ApplicationMailer
@@ -29,9 +29,17 @@ class RequestMailer < ApplicationMailer
# Separate function, so can be called from controller for logging
def RequestMailer.name_and_email_for_followup(info_request, incoming_message_followup)
if incoming_message_followup.nil?
- @recipients = info_request.recipient_name_and_email
+ return info_request.recipient_name_and_email
else
- @recipients = incoming_message_followup.mail.from_addrs.to_s
+ return incoming_message_followup.mail.from_addrs.to_s
+ end
+ end
+ # Used in the preview of followup
+ def RequestMailer.name_for_followup(info_request, incoming_message_followup)
+ if incoming_message_followup.nil?
+ return info_request.public_body.name
+ else
+ return incoming_message_followup.safe_mail_from || info_request.recipient_name
end
end
diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml
index 8ea7b4877..8477f63f4 100644
--- a/app/views/request/_followup.rhtml
+++ b/app/views/request/_followup.rhtml
@@ -49,7 +49,8 @@
<p>
<%= hidden_field_tag 'submitted_followup', 1 %>
- <%= submit_tag "Send public follow up message" %>
+ <%= hidden_field_tag(:preview, 1 ) %>
+ <%= submit_tag "Preview your follow up message" %>
</p>
<% end %>
diff --git a/app/views/request/followup_preview.rhtml b/app/views/request/followup_preview.rhtml
new file mode 100644
index 000000000..543924ed2
--- /dev/null
+++ b/app/views/request/followup_preview.rhtml
@@ -0,0 +1,41 @@
+<% @title = "Preview follow up to '" + h(@info_request.public_body.name) + "'" %>
+
+<div id="followup">
+
+<% form_for(:outgoing_message, @outgoing_message, :html => { :id => 'preview_form' }, :url => (@incoming_message.nil? ? show_response_no_followup_url(:id => @info_request.id) : show_response_url(:id => @info_request.id, :incoming_message_id => @incoming_message.id)) + "#followup" ) do |o| %>
+
+ <h1>Now preview your follow up</h1>
+ <ul>
+ <li>Check you haven't included any <strong>personal information</strong>.</li>
+ <li>Your follow up message will appear in <strong>search engines</strong></li>
+ </ul>
+
+ <% fields_for :outgoing_message do |o| %>
+
+ <div class="correspondence" id="outgoing-0">
+ <p class="preview_subject">
+ <strong>To:</strong> <%=h RequestMailer.name_for_followup(@info_request, @incoming_message) %>
+ <br><strong>Subject:</strong> <%=h @info_request.email_subject_followup %>
+ </p>
+
+ <div class="correspondence_text">
+ <p><%= @outgoing_message.get_body_for_html_display %></p>
+ <%= o.hidden_field(:body) %>
+ </div>
+
+ <p class="event_actions">
+ </p>
+ </div>
+ <% end %>
+
+ <p>
+ <%= hidden_field_tag(:submitted_followup, 1) %>
+ <%= hidden_field_tag(:preview, 0 ) %>
+ <%= submit_tag "Re-edit this follow up", :name => 'reedit' %>
+ <%= submit_tag "Send follow up message", :name => 'submit' %>
+ </p>
+
+<% end %>
+
+</div>
+
diff --git a/todo.txt b/todo.txt
index 1981f7f49..e001c5cc7 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,4 +1,5 @@
-Remove get_body_for_html_preview
+Test with/ without followup message
+Check displays right name
Site move:
Install PostgresSQL 8.3
@@ -24,6 +25,8 @@ Grrr - so here I wanted to clarify my request, but don't want the timer to be re
Clear out all the need admin attention requests
Clear out all the need classifying requests
+Test data for Tony
+
Admin:
Have internal links to different parts of request page
Somehow fold up the enormous pages on many admin pages