diff options
-rw-r--r-- | app/models/outgoing_message.rb | 14 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index b8c5678b0..cf5237f82 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -22,7 +22,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.91 2009-09-17 21:10:05 francis Exp $ +# $Id: outgoing_message.rb,v 1.92 2009-10-03 10:04:06 francis Exp $ class OutgoingMessage < ActiveRecord::Base strip_attributes! @@ -221,6 +221,18 @@ class OutgoingMessage < ActiveRecord::Base text = text.gsub(/\n/, '<br>') return text end + # Testing whether we can just wrap lines rather than between blank line separated paragraphs + def new_get_body_for_html_display + text = self.body.strip + self.remove_privacy_sensitive_things!(text) + #text = MySociety::Format.wrap_email_body(text, 67, " ", "\n") # reparagraph and wrap it so is good preview of emails + text = CGI.escapeHTML(text) + text = MySociety::Format.make_clickable(text, :contract => 1) + text.gsub!(/\[(email address|mobile number)\]/, '[<a href="/help/about#mobiles">\1</a>]') + text = text.gsub(/\n/, '<br>') + return text + end + def fully_destroy ActiveRecord::Base.transaction do diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index b63b5fae3..81c6748ce 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -40,6 +40,10 @@ elsif info_request_event.event_type == 'sent' || info_request_event.event_type = </h2> <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %> + <% if params[:test_new_format] %> + <hr> + <%= render :partial => 'bubble', :locals => { :body => outgoing_message.new_get_body_for_html_display(), :attachments => nil } %> + <% end %> <p class="event_actions"> <% if outgoing_message.status == 'ready' %> |