aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb3
-rw-r--r--app/views/user/_user_listing_single.rhtml1
-rw-r--r--app/views/user/show.rhtml14
3 files changed, 17 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index b94fe8e34..f0416506e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -22,7 +22,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.65 2008-08-31 12:46:53 francis Exp $
+# $Id: user.rb,v 1.66 2008-08-31 14:08:55 francis Exp $
require 'digest/sha1'
@@ -38,6 +38,7 @@ class User < ActiveRecord::Base
has_many :user_info_request_sent_alerts
has_many :post_redirects
has_many :track_things, :foreign_key => 'tracking_user_id', :order => 'created_at desc'
+ has_many :comments, :order => 'created_at desc'
attr_accessor :password_confirmation
validates_confirmation_of :password, :message =>"^Please enter the same password twice"
diff --git a/app/views/user/_user_listing_single.rhtml b/app/views/user/_user_listing_single.rhtml
index 1f52aa613..1362dc780 100644
--- a/app/views/user/_user_listing_single.rhtml
+++ b/app/views/user/_user_listing_single.rhtml
@@ -8,6 +8,7 @@ end %>
<span class="bottomline">
<%= pluralize(display_user.info_requests.size, "request") %> made.
+ <%= pluralize(display_user.comments.size, "annotation") %> made.
Joined on <%= simple_date(display_user.created_at) %>.
</span>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index 59d834e0a..4a5ac33f0 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -73,5 +73,19 @@
<%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests } %>
<% end %>
+
+ <% if @display_user.comments.empty? %>
+ <h2><%= @is_you ? 'Your' : 'This person\'s' %> annotations</h2>
+ <p>None made.</p>
+ <% else %>
+ <h2>
+ <%= @is_you ? 'Your ' : "This person's " %>
+ <%=pluralize(@display_user.comments.size, "annotation") %>
+ </h2>
+
+ <% for comment in @display_user.comments %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => comment.info_request_events[0], :info_request => comment.info_request } %>
+ <% end %>
+ <% end %>
</div>