aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/public_body.rb10
-rw-r--r--app/views/admin_public_body/show.rhtml18
2 files changed, 23 insertions, 5 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index d0e49f2d6..9abc4440d 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -24,7 +24,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.129 2009-02-09 09:51:53 francis Exp $
+# $Id: public_body.rb,v 1.130 2009-02-12 17:24:48 francis Exp $
require 'csv'
require 'set'
@@ -166,6 +166,14 @@ class PublicBody < ActiveRecord::Base
self.non_versioned_columns << 'created_at' << 'updated_at' << 'first_letter'
class Version
attr_accessor :created_at
+
+ def last_edit_comment_for_html_display
+ text = self.last_edit_comment.strip
+ text = CGI.escapeHTML(text)
+ text = MySociety::Format.make_clickable(text)
+ text = text.gsub(/\n/, '<br>')
+ return text
+ end
end
acts_as_xapian :texts => [ :name, :short_name ],
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml
index 1e8f2c4e0..abe621cef 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.rhtml
@@ -3,8 +3,13 @@
<h1><%=@title%></h1>
<p>
-<% for column in PublicBody.content_columns %>
- <b><%= column.human_name %>:</b> <%=h @public_body.send(column.name) %>
+<%
+ columns = PublicBody.content_columns
+ columns.delete_if {|c| ['last_edit_comment'].include?(c.name)}
+
+ for column in columns %>
+ <b><%= column.human_name %>:</b>
+ <%=h @public_body.send(column.name) %>
<br/>
<% end %>
<b>Calculated home page:</b>
@@ -36,10 +41,15 @@
<% for historic_public_body in @public_body.versions.reverse %>
<tr class="<%= cycle('odd', 'even') %>">
<% for column in history_columns %>
- <% # Highlight entries which have changed since previous version
+ <%
+ value = h(historic_public_body.send(column.name))
+ if column.name == 'last_edit_comment'
+ value = historic_public_body.last_edit_comment_for_html_display
+ end
+ # Highlight entries which have changed since previous version
changed = (not ['version', 'last_edit_editor', 'last_edit_comment'].include?(column.name)) && ((historic_public_body.send(column.name) != @public_body.versions[historic_public_body.version - 2].send(column.name)) || (historic_public_body.version == 1)) %>
<td <%= changed ? ' class="entry_changed" ': '' %> >
- <%=h historic_public_body.send(column.name) %>
+ <%=value%>
</td>
<% end %>
<td><%=h historic_public_body.updated_at %></td>