aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/request/_correspondence.html.erb86
-rw-r--r--app/views/request/_incoming_correspondence.html.erb21
-rw-r--r--app/views/request/_outgoing_correspondence.html.erb13
-rw-r--r--app/views/request/_resent_outgoing_correspondence.html.erb16
-rw-r--r--app/views/request/show_response.html.erb8
5 files changed, 63 insertions, 81 deletions
diff --git a/app/views/request/_correspondence.html.erb b/app/views/request/_correspondence.html.erb
index 68711b259..872761749 100644
--- a/app/views/request/_correspondence.html.erb
+++ b/app/views/request/_correspondence.html.erb
@@ -1,80 +1,12 @@
<div class="ff-print-fix"></div>
-<%
-if !info_request_event.nil? && info_request_event.event_type == 'response'
- incoming_message = info_request_event.incoming_message
-end
-
-if not incoming_message.nil?
-%>
- <div class="incoming correspondence" id="incoming-<%=incoming_message.id.to_s%>">
- <h2>
- <% if !incoming_message.safe_mail_from.nil? && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %>
- <%= _("From:") %> <%=h incoming_message.safe_mail_from %><br>
- <% end %>
- <% if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %>
- <%=h @info_request.public_body.name %><br>
- <% end %>
- <br><%= simple_date(incoming_message.sent_at) %>
- </h2>
-
- <%= render :partial => 'bubble', :locals => { :incoming_message => incoming_message, :body => incoming_message.get_body_for_html_display(@collapse_quotes), :attachments => incoming_message.get_attachments_for_display } %>
-
- <p class="event_actions">
- <% if !@user.nil? && @user.admin_page_links? %>
- <%= link_to "Admin", admin_request_show_raw_email_path(incoming_message.raw_email_id) %> |
- <% end %>
- <%= link_to _("Link to this"), incoming_message_path(incoming_message), :class => "link_to_this" %>
- </p>
- </div>
-<%
-elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
- outgoing_message = info_request_event.outgoing_message
- %>
- <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
-
- <h2>
- <%= _("From:") %> <%=h @info_request.user_name %><br>
- <br><%= simple_date(info_request_event.created_at) %>
- </h2>
-
- <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %>
-
- <p class="event_actions">
- <% if outgoing_message.status == 'ready' && !@info_request.is_external? %>
- <strong>Warning:</strong> This message has <strong>not yet been sent</strong> for an unknown reason.
- <% end %>
-
- <!-- Can use this to get name of who followup was too, if say you
- play with proper from display, but not sure needed
- <% if outgoing_message.message_type == 'followup' && !outgoing_message.incoming_message_followup.nil? && !outgoing_message.incoming_message_followup.safe_mail_from.nil? %>
- Follow up sent to: <%=h outgoing_message.incoming_message_followup.safe_mail_from %>
- <% end %>
- -->
-
- <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %>
- </p>
- </div>
-<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
- <div class="outgoing correspondence" id="outgoing-<%=info_request_event.outgoing_message.id.to_s%>">
- <h2>
- <%= simple_date(info_request_event.created_at) %>
- </h2>
- <p class="event_plain">
- Sent
- <% if info_request_event.outgoing_message.message_type == 'initial_request' %>
- request
- <% elsif info_request_event.outgoing_message.message_type == 'followup' %>
- a follow up
- <% else %>
- <% raise "unknown message_type" %>
- <% end %>
-
- to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.
- </p>
- </div>
-<% elsif info_request_event.event_type == 'comment'
- comment = info_request_event.comment
-%>
- <%= render :partial => 'comment/single_comment', :locals => { :comment => comment } %>
+<% case info_request_event.event_type %>
+<% when 'response' %>
+ <%= render :partial => 'request/incoming_correspondence', :locals => { :incoming_message => info_request_event.incoming_message } %>
+<% when 'sent', 'followup_sent' %>
+ <%= render :partial => 'request/outgoing_correspondence', :locals => { :outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
+<% when 'resent', 'followup_resent' %>
+ <%= render :partial => 'request/resent_outgoing_correspondence', :locals => { outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
+<% when 'comment' %>
+ <%= render :partial => 'comment/single_comment', :locals => { :comment => info_request_event.comment } %>
<% end %>
diff --git a/app/views/request/_incoming_correspondence.html.erb b/app/views/request/_incoming_correspondence.html.erb
new file mode 100644
index 000000000..7c9a8f551
--- /dev/null
+++ b/app/views/request/_incoming_correspondence.html.erb
@@ -0,0 +1,21 @@
+<div class="incoming correspondence" id="incoming-<%=incoming_message.id.to_s%>">
+ <h2>
+ <% if incoming_message.safe_mail_from && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %>
+ <%= _("From:") %> <%= incoming_message.safe_mail_from %><br>
+ <% end %>
+ <% if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %>
+ <%= @info_request.public_body.name %><br>
+ <% end %>
+ <br><%= simple_date(incoming_message.sent_at) %>
+ </h2>
+
+ <%= render :partial => 'bubble', :locals => { :incoming_message => incoming_message, :body => incoming_message.get_body_for_html_display(@collapse_quotes), :attachments => incoming_message.get_attachments_for_display } %>
+
+ <p class="event_actions">
+ <% if !@user.nil? && @user.admin_page_links? %>
+ <%= link_to "Admin", admin_request_show_raw_email_path(incoming_message.raw_email_id) %> |
+ <% end %>
+ <%= link_to _("Link to this"), incoming_message_path(incoming_message), :class => "link_to_this" %>
+ </p>
+</div>
+
diff --git a/app/views/request/_outgoing_correspondence.html.erb b/app/views/request/_outgoing_correspondence.html.erb
new file mode 100644
index 000000000..b43af0753
--- /dev/null
+++ b/app/views/request/_outgoing_correspondence.html.erb
@@ -0,0 +1,13 @@
+<div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
+ <h2>
+ <%= _("From:") %> <%= @info_request.user_name %><br>
+ <br><%= simple_date(info_request_event.created_at) %>
+ </h2>
+ <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %>
+ <p class="event_actions">
+ <% if outgoing_message.status == 'ready' && !@info_request.is_external? %>
+ <strong>Warning:</strong> This message has <strong>not yet been sent</strong> for an unknown reason.
+ <% end %>
+ <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %>
+ </p>
+</div>
diff --git a/app/views/request/_resent_outgoing_correspondence.html.erb b/app/views/request/_resent_outgoing_correspondence.html.erb
new file mode 100644
index 000000000..17b6b635b
--- /dev/null
+++ b/app/views/request/_resent_outgoing_correspondence.html.erb
@@ -0,0 +1,16 @@
+<div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
+ <h2>
+ <%= simple_date(info_request_event.created_at) %>
+ </h2>
+ <p class="event_plain">
+ Sent
+ <% if outgoing_message.message_type == 'initial_request' %>
+ request
+ <% elsif outgoing_message.message_type == 'followup' %>
+ a follow up
+ <% else %>
+ <% raise "unknown message_type" %>
+ <% end %>
+ to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.
+ </p>
+</div>
diff --git a/app/views/request/show_response.html.erb b/app/views/request/show_response.html.erb
index a61359679..ace86cf4c 100644
--- a/app/views/request/show_response.html.erb
+++ b/app/views/request/show_response.html.erb
@@ -36,7 +36,7 @@
<dd>
<%= _('To do that please send a private email to ') %><%=h(@postal_email_name)%>
&lt;<%=link_to h(@postal_email), "mailto:" + @postal_email%>&gt;
- <%= _('containing your postal address, and asking them to reply to this request.
+ <%= _('containing your postal address, and asking them to reply to this request.
Or you could phone them.') %>
<%= _('When you receive the paper response, please help
@@ -63,16 +63,16 @@
<% end %>
<% else %>
<% if @incoming_message.recently_arrived %>
- <h2><%= _('New response to {{law_used_short}} request',:law_used_short => h(@info_request.law_used_short))%> '<%= request_link @info_request %>'</h2>
+ <h2><%= _('New response to {{law_used_short}} request',:law_used_short => h(@info_request.law_used_short))%> '<%= request_link @info_request %>'</h2>
<% else %>
<h2>Response to <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2>
<% end %>
<% end %>
<% if @incoming_message.nil? %>
- <%= render :partial => 'correspondence', :locals => { :info_request_event => @info_request.get_last_outgoing_event, :incoming_message => nil } %>
+ <%= render :partial => 'correspondence', :locals => { :info_request_event => @info_request.get_last_outgoing_event } %>
<% else %>
- <%= render :partial => 'correspondence', :locals => { :info_request_event => nil, :incoming_message => @incoming_message } %>
+ <%= render :partial => 'correspondence', :locals => { :info_request_event => @incoming_message.response_event } %>
<% end %>
<% end %>