diff options
-rw-r--r-- | app/controllers/admin_controller.rb | 10 | ||||
-rw-r--r-- | app/models/public_body.rb | 6 | ||||
-rw-r--r-- | app/views/admin/timeline.rhtml | 67 | ||||
-rw-r--r-- | todo.txt | 7 |
4 files changed, 54 insertions, 36 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index f9293d473..3718b0bd2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_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: admin_controller.rb,v 1.8 2008-04-03 19:45:47 francis Exp $ +# $Id: admin_controller.rb,v 1.9 2008-04-09 02:51:46 francis Exp $ class AdminController < ApplicationController layout "admin" @@ -36,6 +36,14 @@ class AdminController < ApplicationController end @events = InfoRequestEvent.find(:all, :order => "created_at desc, id desc", :conditions => ["created_at > ? ", date_back_to]) + @public_body_history = PublicBody.versioned_class.find(:all, :order => "updated_at desc, id desc", + :conditions => ["updated_at > ? ", date_back_to]) + for pbh in @public_body_history + pbh.created_at = pbh.updated_at + end + @events += @public_body_history + + @events.sort! { |a,b| b.created_at <=> a.created_at } end end diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 41b298b62..178b6f23b 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -21,7 +21,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.52 2008-04-04 01:44:41 francis Exp $ +# $Id: public_body.rb,v 1.53 2008-04-09 02:51:46 francis Exp $ require 'csv' require 'set' @@ -69,6 +69,10 @@ class PublicBody < ActiveRecord::Base acts_as_versioned self.non_versioned_columns << 'created_at' << 'updated_at' + class Version + attr_accessor :created_at + end + acts_as_solr :fields => [ {:name => { :boost => 10.0 }}, diff --git a/app/views/admin/timeline.rhtml b/app/views/admin/timeline.rhtml index 444f321cf..4ae3f5018 100644 --- a/app/views/admin/timeline.rhtml +++ b/app/views/admin/timeline.rhtml @@ -20,44 +20,51 @@ <% last_date = event.created_at.to_date %> - '<%= link_to h(event.info_request.title), main_url(request_url(event.info_request)) %>' - <% if event.event_type == 'edit' %> - was edited by administrator <%=h event.params[:editor] %>. - <% for p in ['title', 'prominence', 'described_state', 'awaiting_description'] - if event.params[p.to_sym] != event.params[('old_'+p).to_sym] - %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% - end - end - %> - <% elsif event.event_type == 'edit_outgoing' %> - <% outgoing_messages = OutgoingMessage.find(:all, event.params[:outgoing_message_id].to_i) %> - had outgoing message edited by administrator <%=h event.params[:editor] %>. - <% if outgoing_messages.size > 0 %> - <% outgoing_message = outgoing_messages[0] %> - <% for p in ['body'] + <% if event.class.to_s == 'InfoRequestEvent' %> + '<%= link_to h(event.info_request.title), main_url(request_url(event.info_request)) %>' + (<%= link_to "admin", "request/show/" + event.info_request.id.to_s %>) + <% if event.event_type == 'edit' %> + was edited by administrator <strong><%=h event.params[:editor] %></strong>. + <% for p in ['title', 'prominence', 'described_state', 'awaiting_description'] if event.params[p.to_sym] != event.params[('old_'+p).to_sym] %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% end end %> + <% elsif event.event_type == 'edit_outgoing' %> + <% outgoing_messages = OutgoingMessage.find(:all, event.params[:outgoing_message_id].to_i) %> + had outgoing message edited by administrator <strong><%=h event.params[:editor] %></strong>. + <% if outgoing_messages.size > 0 %> + <% outgoing_message = outgoing_messages[0] %> + <% for p in ['body'] + if event.params[p.to_sym] != event.params[('old_'+p).to_sym] + %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% + end + end + %> + <% else %> + Missing outgoing message, internal error. + <% end %> + <% elsif event.event_type == 'response' %> + <% incoming_message = event.incoming_message %> + received + <%= link_to 'a response', + main_url(show_response_url(:id => incoming_message.info_request.id, :incoming_message_id => incoming_message.id, :only_path => true)) %> + + from <%=h event.info_request.public_body.name %>. + <% elsif event.event_type == 'sent' %> + was initially sent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. + <% elsif event.event_type == 'resent' %> + had the request resent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. + <% elsif event.event_type == 'followup_sent' %> + had a follow up message sent to <%=h event.info_request.public_body.name %>. <% else %> - Missing outgoing message, internal error. + had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>. <% end %> - <% elsif event.event_type == 'response' %> - <% incoming_message = event.incoming_message %> - received - <%= link_to 'a response', - main_url(show_response_url(:id => incoming_message.info_request.id, :incoming_message_id => incoming_message.id, :only_path => true)) %> - - from <%=h event.info_request.public_body.name %>. - <% elsif event.event_type == 'sent' %> - was initially sent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. - <% elsif event.event_type == 'resent' %> - had the request resent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. - <% elsif event.event_type == 'followup_sent' %> - had a follow up message sent to <%=h event.info_request.public_body.name %>. <% else %> - had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>. + <%= link_to event.public_body.name, main_url(public_body_url(event.public_body)) %> + (<%= link_to "admin", "body/show/" + event.public_body_id.to_s %>) + was created/updated by administrator <strong><%=h event.last_edit_editor %></strong> <% end %> <% end %> <% if not @events.empty? %> @@ -38,12 +38,8 @@ If you edit needs anim to waiting_response it doesn't edit the value in the even https://secure.mysociety.org/admin/foi/request/show/37 https://secure.mysociety.org/admin/foi/request/show/137 -Show history of recent changes done by admins GUI for uploading changed CSV files -Search and replace text "FOI" and "Freedom of Information" out the way more - - but put it in the title tag - Later ===== @@ -67,6 +63,9 @@ Go through all has_many and pick something sane Offer search on 404s +Search and replace text "FOI" and "Freedom of Information" out the way more + - but put it in the title tag + RDAs need their short names somehow in CSV import? Send email to remind people to clarify |