aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/comments.rb61
-rw-r--r--app/models/contact_validator.rb4
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/models/info_request.rb4
-rw-r--r--app/models/info_request_event.rb4
-rw-r--r--app/models/outgoing_message.rb4
-rw-r--r--app/models/post_redirect.rb4
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/models/public_body_tag.rb4
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/track_things_sent_email.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_info_request_sent_alert.rb4
-rw-r--r--app/views/comment/_comment_form.rhtml15
-rw-r--r--app/views/help/about.rhtml16
-rw-r--r--app/views/request/show.rhtml52
16 files changed, 168 insertions, 24 deletions
diff --git a/app/models/comments.rb b/app/models/comments.rb
new file mode 100644
index 000000000..00e58df55
--- /dev/null
+++ b/app/models/comments.rb
@@ -0,0 +1,61 @@
+# == Schema Information
+# Schema version: 62
+#
+# Table name: comments
+#
+# id :integer not null, primary key
+# user_id :integer not null
+# comment_type :string(255) default("internal_error"), not null
+# info_request_id :integer
+# body :text not null
+# visible :boolean default(true), not null
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+
+# models/comments.rb:
+# A comment by a user upon something.
+#
+# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: comments.rb,v 1.1 2008-08-09 15:19:01 francis Exp $
+
+class Comments < ActiveRecord::Base
+ belongs_to :user
+ validates_presence_of :user
+
+ validates_inclusion_of :comment_type, :in => [ 'request' ]
+ belongs_to :info_request
+
+ def body
+ ret = read_attribute(:body)
+ if ret.nil?
+ return ret
+ end
+ ret = ret.strip
+ ret = ret.gsub(/(?:\n\s*){2,}/, "\n\n") # remove excess linebreaks that unnecessarily space it out
+ ret
+ end
+ def raw_body
+ read_attribute(:body)
+ end
+
+ # Check have edited comment
+ def validate
+ if self.body.empty? || self.body =~ /^\s+$/
+ errors.add(:body, "^Please enter your annotation")
+ end
+ end
+
+ # Return body for display as HTML
+ def get_body_for_html_display
+ text = self.body.strip
+ text = CGI.escapeHTML(text)
+ text = MySociety::Format.make_clickable(text, :contract => 1)
+ text = text.gsub(/\n/, '<br>')
+ return text
+ end
+end
+
+
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index 9d114bd85..a0bcbf229 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: contact_validators
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: contact_validator.rb,v 1.18 2008-07-17 10:32:01 francis Exp $
+# $Id: contact_validator.rb,v 1.19 2008-08-09 15:19:01 francis Exp $
class ContactValidator < ActiveRecord::BaseWithoutTable
column :name, :string
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index ada3eeb7a..3f625f539 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: incoming_messages
#
@@ -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.128 2008-08-08 01:31:50 francis Exp $
+# $Id: incoming_message.rb,v 1.129 2008-08-09 15:19:01 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 447ff6c1a..da82f8ab4 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: info_requests
#
@@ -23,7 +23,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.125 2008-07-30 13:31:00 francis Exp $
+# $Id: info_request.rb,v 1.126 2008-08-09 15:19:01 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 15e758275..4eff38554 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: info_request_events
#
@@ -20,7 +20,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.49 2008-07-17 10:32:01 francis Exp $
+# $Id: info_request_event.rb,v 1.50 2008-08-09 15:19:01 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index b5e9f7786..d02037374 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: outgoing_messages
#
@@ -21,7 +21,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.57 2008-07-30 13:31:00 francis Exp $
+# $Id: outgoing_message.rb,v 1.58 2008-08-09 15:19:01 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index edc9ed63f..21130d515 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: post_redirects
#
@@ -26,7 +26,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.36 2008-07-17 10:32:01 francis Exp $
+# $Id: post_redirect.rb,v 1.37 2008-08-09 15:19:01 francis Exp $
require 'openssl' # for random bytes function
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index dd19f6d00..4a51f4e51 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: public_bodies
#
@@ -23,7 +23,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.94 2008-08-07 20:46:32 johncross Exp $
+# $Id: public_body.rb,v 1.95 2008-08-09 15:19:01 francis Exp $
require 'csv'
require 'set'
diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb
index 4f5e48fdb..af459b35b 100644
--- a/app/models/public_body_tag.rb
+++ b/app/models/public_body_tag.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: public_body_tags
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body_tag.rb,v 1.15 2008-07-17 10:32:01 francis Exp $
+# $Id: public_body_tag.rb,v 1.16 2008-08-09 15:19:01 francis Exp $
class PublicBodyTag < ActiveRecord::Base
validates_presence_of :public_body
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index c6215660e..c266c2167 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: track_things
#
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.34 2008-08-09 00:47:45 francis Exp $
+# $Id: track_thing.rb,v 1.35 2008-08-09 15:19:01 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index ccfc79cb4..f21cf4d2c 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: track_things_sent_emails
#
@@ -18,7 +18,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_things_sent_email.rb,v 1.9 2008-07-17 10:32:01 francis Exp $
+# $Id: track_things_sent_email.rb,v 1.10 2008-08-09 15:19:01 francis Exp $
class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :info_request_event
diff --git a/app/models/user.rb b/app/models/user.rb
index 515c4e733..9c160dbd5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: users
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.60 2008-07-28 17:59:41 francis Exp $
+# $Id: user.rb,v 1.61 2008-08-09 15:19:01 francis Exp $
require 'digest/sha1'
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index c80c834b8..af3c6e981 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: user_info_request_sent_alerts
#
@@ -17,7 +17,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user_info_request_sent_alert.rb,v 1.19 2008-07-17 10:32:01 francis Exp $
+# $Id: user_info_request_sent_alert.rb,v 1.20 2008-08-09 15:19:01 francis Exp $
class UserInfoRequestSentAlert < ActiveRecord::Base
belongs_to :user
diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml
new file mode 100644
index 000000000..d1ce0a61a
--- /dev/null
+++ b/app/views/comment/_comment_form.rhtml
@@ -0,0 +1,15 @@
+<% form_for(:comment, @comment) do |o| %>
+ <p>
+ <%= o.text_area :body, :rows => 10, :cols => 55 %>
+ </p>
+
+ <p>
+ Don't bother posting up nonsense (<a href="/help/about#moderation">like what sort of nonsense?</a>).
+ </p>
+
+ <p>
+ <%= hidden_field_tag 'submitted_comment', 1 %>
+ <%= submit_tag "Add public annotation" %>
+ </p>
+<% end %>
+
diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml
index a8dfa216d..e9434f379 100644
--- a/app/views/help/about.rhtml
+++ b/app/views/help/about.rhtml
@@ -184,6 +184,22 @@ address should be treated as the return address."
</p>
</dd>
+<dt id="moderation">What will you do to me if I annotate requests with nonsense?</dt>
+
+<dd>
+<p>It won't be pretty :). </p>
+<p>Seriously, annotations on WhatDoTheyKnow are to help
+people get the information they want, or to give them pointers to places they
+can go to help them act on it. We reserve the right to remove anything else.
+Endless, content-free political discussions are not allowed, but
+do post a link to a suitable forum elsewhere.</p>
+<p>For example, if you think you know the reason someone posted a request,
+and you don't approve of it, do not write a complex rant in the annotation.
+Instead, simply write a short sentence, and link to another website which
+already explains it in detail.
+</p>
+<dd>
+
</dl>
<h1 id="officers">FOI officer questions</h1>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 136b75499..e5ac5b008 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -97,6 +97,58 @@
<% for info_request_event in @info_request_events %>
<%= render :partial => 'correspondence', :locals => { :info_request_event => info_request_event } %>
<% end %>
+
+ <!--
+
+ <div id="comment_form">
+ <h2>Add an annotation</h2>
+
+ <p>
+ Help the requester with their request. Things you can do:
+ </p>
+
+ <ul>
+
+ <% if [ 'waiting_clarification' ].include?(@info_request.described_state) %>
+ <li> Advise on how to <strong>best clarify</strong> the request.</li>
+ <% end %>
+
+ <% if @info_request.awaiting_description %>
+ <% end %>
+
+ <% if not [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Link to the information requested, if it is <strong>already available</strong> on the Internet. </li>
+ <li> Suggest <strong>where else</strong> the requester might find the information. </li>
+ <li> Offer better ways of <strong>wording the request</strong> to get the information. </li>
+ <% end %>
+
+ <% if [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> <strong>Summarise</strong> the content of any information returned. </li>
+ <li> Say how you've <strong>used the information</strong>, with links if possible. </li>
+ <li> <strong>Thank</strong> the local authority or <%=h @info_request.user.name %>. </li>
+ <% end %>
+ <% if [ 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Suggest how the requester can find the <strong>rest of the information</strong>. </li>
+ <% end %>
+ <% if [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Point to <strong>related information</strong>, campaigns or forums which may be useful. </li>
+ <% end %>
+
+ <% if [ 'not_held' ].include?(@info_request.described_state) %>
+ <li> Ideas on what <strong>other documents to request</strong> which the authority may hold. </li>
+ <% end %>
+ <% if [ 'rejected' ].include?(@info_request.described_state) %>
+ <li> Advise on whether the <strong>rejection is legal</strong>, and how to complain about if not. </li>
+ <% end %>
+
+ <% if [ 'requires_admin' ].include?(@info_request.described_state) %>
+ <li> Your thoughts on what the WhatDoTheyKnow <strong>administrators</strong> should do about the request. </li>
+ <% end %>
+
+ </ul>
+
+ <%= render :partial => 'comment/comment_form', :locals => { } %>
+ </div> -->
</div>