aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/post_redirect.rb3
-rw-r--r--app/models/user.rb3
-rw-r--r--app/views/admin_user/show.rhtml21
3 files changed, 24 insertions, 3 deletions
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 2507cfdd6..3b79e638f 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -25,7 +25,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.20 2008-02-27 14:01:30 francis Exp $
+# $Id: post_redirect.rb,v 1.21 2008-02-28 16:25:30 francis Exp $
require 'openssl' # for random bytes function
@@ -68,7 +68,6 @@ class PostRedirect < ActiveRecord::Base
self.token = PostRedirect.generate_random_token
end
# There is a separate token to use in the URL if we send a confirmation email.
- # This is because
if not self.email_token
self.email_token = PostRedirect.generate_random_token
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 277d8958d..bc1028ae1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -20,7 +20,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.32 2008-02-28 12:29:43 francis Exp $
+# $Id: user.rb,v 1.33 2008-02-28 16:25:30 francis Exp $
require 'digest/sha1'
@@ -34,6 +34,7 @@ class User < ActiveRecord::Base
has_many :info_requests
has_many :user_info_request_sent_alerts
+ has_many :post_redirects
attr_accessor :password_confirmation
validates_confirmation_of :password, :message =>"^Please enter the same password twice"
diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml
index 82681dc79..d0d68b96a 100644
--- a/app/views/admin_user/show.rhtml
+++ b/app/views/admin_user/show.rhtml
@@ -18,3 +18,24 @@
<p><%= link_to 'Public page', main_url(user_url(@admin_user)) %></p>
+<h2>Post redirects</h2>
+
+<table>
+ <tr>
+ <th>Id</th>
+ <% for column in PostRedirect.content_columns %>
+ <th><%= column.human_name %></th>
+ <% end %>
+ </tr>
+
+<% for post_redirect in @admin_user.post_redirects.find(:all, :order => 'created_at') %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%=h post_redirect.id %></td>
+ <% for column in PostRedirect.content_columns.map { |c| c.name } %>
+ <td><%=h post_redirect.send(column) %></td>
+ <% end %>
+ </tr>
+<% end %>
+</table>
+
+