diff options
author | francis <francis> | 2007-12-22 03:04:27 +0000 |
---|---|---|
committer | francis <francis> | 2007-12-22 03:04:27 +0000 |
commit | 9bcb88b565bbd22156976ef222abf8f4fd5fe290 (patch) | |
tree | 611895b7082221cccb05a961f0bac85a14507429 | |
parent | 1b2a66f96f305b2aba2c86a9e1c5e96a2119f839 (diff) |
Display outgoing message properly as HTML.
-rw-r--r-- | app/models/incoming_message.rb | 4 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 13 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index be65a4b60..7b1e9c255 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.8 2007-12-22 02:23:35 francis Exp $ +# $Id: incoming_message.rb,v 1.9 2007-12-22 03:04:27 francis Exp $ class IncomingMessage < ActiveRecord::Base belongs_to :info_request @@ -79,7 +79,7 @@ class IncomingMessage < ActiveRecord::Base return text end - # Returns body text with quotes flattened, and emails removed. + # Returns body text as HTML with quotes flattened, and emails removed. def get_body_for_display(collapse_quoted_sections = true) parts = self.mail.parts if parts.size > 0 diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index af3ace9e4..2f46ce84e 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -20,7 +20,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.12 2007-12-17 00:34:55 francis Exp $ +# $Id: outgoing_message.rb,v 1.13 2007-12-22 03:04:27 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request @@ -77,5 +77,16 @@ class OutgoingMessage < ActiveRecord::Base raise "Message id #{self.id} has type '#{self.message_type}' status '#{self.status}' " end end + + # Return body for display as HTML + def get_body_for_display + text = body + text = text.gsub(/\n/, '<br>') + + return text + end + + end + diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index aa6b799fa..80f92c50a 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -2,7 +2,7 @@ <% if (correspondence.class.to_s == 'OutgoingMessage') outgoing_message = correspondence %> - <%= render :partial => 'bubble', :locals => { :body => outgoing_message.body } %> + <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_display() } %> <p class="xspeaker"> <%= user_link(@info_request.user) %> |