diff options
-rw-r--r-- | app/controllers/admin_request_controller.rb | 35 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 4 | ||||
-rw-r--r-- | app/models/info_request.rb | 7 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 3 | ||||
-rw-r--r-- | app/views/admin_request/edit_outgoing.rhtml | 3 | ||||
-rw-r--r-- | app/views/admin_request/show.rhtml | 5 | ||||
-rw-r--r-- | db/migrate/033_add_prominence.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 17 | ||||
-rw-r--r-- | todo.txt | 17 |
9 files changed, 64 insertions, 36 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 3b69ff8ed..504ce0c23 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_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_request_controller.rb,v 1.5 2008-02-14 07:45:08 francis Exp $ +# $Id: admin_request_controller.rb,v 1.6 2008-02-15 11:18:55 francis Exp $ class AdminRequestController < ApplicationController layout "admin" @@ -29,25 +29,44 @@ class AdminRequestController < ApplicationController redirect_to request_admin_url(@outgoing_message.info_request) end + def edit + @info_request = InfoRequest.find(params[:id]) + end + + def update + @info_request = InfoRequest.find(params[:id]) + + old_title = @info_request.title + old_prominence = @info_request.prominence + + if @info_request.update_attributes(params[:info_request]) + @info_request.log_event("edit", + { :editor => admin_http_auth_user(), + :old_title => old_title, :title => @info_request.title, + :old_prominence => old_prominence, :prominence => @info_request.prominence, + }) + flash[:notice] = 'Request successfully updated.' + redirect_to request_admin_url(@info_request) + else + render :action => 'edit_outgoing' + end + end + def edit_outgoing @outgoing_message = OutgoingMessage.find(params[:id]) - @info_request = @outgoing_message.info_request end def update_outgoing @outgoing_message = OutgoingMessage.find(params[:id]) - @info_request = @outgoing_message.info_request old_body = @outgoing_message.body - old_title = @info_request.title - if @outgoing_message.update_attributes(params[:outgoing_message]) and @info_request.update_attributes(params[:info_request]) + if @outgoing_message.update_attributes(params[:outgoing_message]) @outgoing_message.info_request.log_event("edit_outgoing", { :outgoing_message_id => @outgoing_message.id, :editor => admin_http_auth_user(), - :old_title => old_title, :title => @info_request.title, :old_body => old_body, :body => @outgoing_message.body }) - flash[:notice] = 'Request successfully updated.' - redirect_to request_admin_url(@info_request) + flash[:notice] = 'Outgoing message successfully updated.' + redirect_to request_admin_url(@outgoing_message.info_request) else render :action => 'edit_outgoing' end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index e8ca767fa..97bb37c39 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_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: request_controller.rb,v 1.48 2008-02-14 09:57:56 francis Exp $ +# $Id: request_controller.rb,v 1.49 2008-02-15 11:18:55 francis Exp $ class RequestController < ApplicationController @@ -22,7 +22,7 @@ class RequestController < ApplicationController end def list - @info_requests = InfoRequest.paginate :order => "created_at desc", :page => params[:page], :per_page => 25 + @info_requests = InfoRequest.paginate :order => "created_at desc", :page => params[:page], :per_page => 25, :conditions => "prominence = 'normal'" end def frontpage diff --git a/app/models/info_request.rb b/app/models/info_request.rb index cf50bf986..5a352026e 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.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: info_request.rb,v 1.40 2008-02-14 15:31:22 francis Exp $ +# $Id: info_request.rb,v 1.41 2008-02-15 11:18:55 francis Exp $ require 'digest/sha1' @@ -47,6 +47,11 @@ class InfoRequest < ActiveRecord::Base 'partially_successful' ] + validates_inclusion_of :prominence, :in => [ + 'normal', + 'backpage', + ] + def after_initialize if self.described_state.nil? self.described_state = 'waiting_response' diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index ebd03d855..a8c2c7f50 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -16,7 +16,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.14 2008-02-14 15:31:22 francis Exp $ +# $Id: info_request_event.rb,v 1.15 2008-02-15 11:18:55 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -27,6 +27,7 @@ class InfoRequestEvent < ActiveRecord::Base 'sent', 'resent', 'followup_sent', + 'edit', # title etc. edited in admin interface 'edit_outgoing', # outgoing message edited in admin interface 'manual', # you did something in the db by hand 'response' diff --git a/app/views/admin_request/edit_outgoing.rhtml b/app/views/admin_request/edit_outgoing.rhtml index 3f59fad1f..099658e44 100644 --- a/app/views/admin_request/edit_outgoing.rhtml +++ b/app/views/admin_request/edit_outgoing.rhtml @@ -4,9 +4,6 @@ <% form_tag '../update_outgoing/' + @outgoing_message.id.to_s do %> - <p><label for="info_request_title">Title</label><br/> - <%= text_field 'info_request', 'title', :size => 50 %></p> - <p><label for="outgoing_message_body">Body of message</label><br/> <%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %></p> diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 690d85905..940972187 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -13,7 +13,10 @@ <strong>Envelope email address:</strong> <%=h @info_request.envelope_email %> <br> </p> -<p><%= link_to 'Public page', main_url(request_url(@info_request)) %></p> +<p> +<%= link_to 'Public page', main_url(request_url(@info_request)) %> +| <%= link_to "Edit", '../edit/' + @info_request.id.to_s %> +</p> <h2>Outgoing messages</h2> diff --git a/db/migrate/033_add_prominence.rb b/db/migrate/033_add_prominence.rb new file mode 100644 index 000000000..15d548f37 --- /dev/null +++ b/db/migrate/033_add_prominence.rb @@ -0,0 +1,9 @@ +class AddProminence < ActiveRecord::Migration + def self.up + add_column :info_requests, :prominence, :string, :null => false, :default => 'normal' + end + + def self.down + remove_column :info_requests, :prominence + end +end diff --git a/db/schema.rb b/db/schema.rb index c01221291..ff159b5c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 32) do +ActiveRecord::Schema.define(:version => 33) do create_table "incoming_messages", :force => true do |t| t.integer "info_request_id", :null => false @@ -28,13 +28,14 @@ ActiveRecord::Schema.define(:version => 32) do end create_table "info_requests", :force => true do |t| - t.text "title", :null => false - t.integer "user_id", :null => false - t.integer "public_body_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "described_state", :null => false - t.boolean "awaiting_description", :default => false, :null => false + t.text "title", :null => false + t.integer "user_id", :null => false + t.integer "public_body_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "described_state", :null => false + t.boolean "awaiting_description", :default => false, :null => false + t.string "prominence", :default => "normal", :null => false end add_index "info_requests", ["created_at"], :name => "index_info_requests_on_created_at" @@ -14,20 +14,10 @@ BAILII - relationship with law courts, robots.txt ? Status of messages stuff ======================== -You can send a followup, not be making a clarification, and it puts the - thing in awaiting state when it shouldn't really - -Use sent again date when there has been resent?, e.g. for - http://foi.mysociety.org/request/16 -Make date estimate use follow up time etc. - Status inputting: cope with "other" case when something is both (e.g. received some AND clarify) search for 'classify' and tidy text -Status here is wrong: - http://foi.mysociety.org/request/11 - Show proper due date on, e.g. http://foi.mysociety.org/request/4 http://foi.mysociety.org/request/17 @@ -52,13 +42,16 @@ Do something at least a bit aggressive when response is late Add - response was made in private state or maybe 'response refusing to publish for spurious reasons +Go through all requests and check status is shiny + Next ==== -Consider on staging sites making follow ups go to dummy address also +"By law, you should get a response before the end of 23 January 2008." message needs updating +if that is in the future. -Check "From:" of requests and followups, it is coming out as GovernmentSpy rather than the user +Consider on staging sites making follow ups go to dummy address also Change ..@.. to something prettier / less confusing Put the admin "Public page" link on request page somewhere clearer |