aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_request_controller.rb4
-rw-r--r--app/controllers/admin_user_controller.rb28
-rw-r--r--app/helpers/link_to_helper.rb4
-rw-r--r--app/views/admin_user/list.rhtml28
-rw-r--r--app/views/admin_user/show.rhtml20
-rw-r--r--app/views/layouts/admin.rhtml1
6 files changed, 81 insertions, 4 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index f474a3beb..79705a8aa 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -1,10 +1,10 @@
# app/controllers/admin_request_controller.rb:
-# Controller for editing public bodies from the admin interface.
+# Controller for viewing FOI requests from the admin interface.
#
# 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.2 2008-01-07 13:26:46 francis Exp $
+# $Id: admin_request_controller.rb,v 1.3 2008-01-22 18:34:15 francis Exp $
class AdminRequestController < ApplicationController
layout "admin"
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
new file mode 100644
index 000000000..f62250ce1
--- /dev/null
+++ b/app/controllers/admin_user_controller.rb
@@ -0,0 +1,28 @@
+# app/controllers/admin_user_controller.rb:
+# Controller for viewing user accounts from the admin interface.
+#
+# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: admin_user_controller.rb,v 1.1 2008-01-22 18:34:15 francis Exp $
+
+class AdminUserController < ApplicationController
+ layout "admin"
+
+ def index
+ list
+ render :action => 'list'
+ end
+
+ def list
+ @admin_users = User.paginate :order => "name", :page => params[:page], :per_page => 100
+ end
+
+ def show
+ # Don't use @user as that is any logged in user
+ @admin_user = User.find(params[:id])
+ end
+
+ private
+
+end
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 381d45122..7e90cddc5 100644
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: link_to_helper.rb,v 1.9 2008-01-21 18:53:41 francis Exp $
+# $Id: link_to_helper.rb,v 1.10 2008-01-22 18:34:15 francis Exp $
module LinkToHelper
@@ -75,7 +75,7 @@ module LinkToHelper
# Where stylesheets used by admin page sit under
def admin_public_url(relative_path)
admin_url_prefix = MySociety::Config.get("ADMIN_PUBLIC_URL", "/")
- return admin_url_prefix + relative_path
+ return (admin_url_prefix + relative_path).gsub('//', '/') # XXX stylesheet_path includes a /, as do our url_prefixes by convention
end
def main_url(relative_path)
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml
new file mode 100644
index 000000000..b65b640e4
--- /dev/null
+++ b/app/views/admin_user/list.rhtml
@@ -0,0 +1,28 @@
+<% @title = 'Listing users' %>
+
+<h1><%=@title%></h1>
+
+<table>
+ <tr>
+ <th>ID</th>
+ <% for column in ['Name', 'Email', 'Created at', 'Updated at', 'Email confirmed'] %>
+ <th><%= column %></th>
+ <% end %>
+ </tr>
+
+<% for user in @admin_users %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= user.id.to_s %></td>
+ <td><%= link_to h(user.name), 'show/' + user.id.to_s %></td>
+ <td><a href="mailto:<%=h user.email %>"><%=h user.email%></td>
+ <% for column in ['created_at', 'updated_at', 'email_confirmed'] %>
+ <td><%=h user.send(column) %></td>
+ <% end %>
+ </tr>
+<% end %>
+</table>
+
+<%= will_paginate(@admin_users) %>
+
+<br />
+
diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml
new file mode 100644
index 000000000..f63720234
--- /dev/null
+++ b/app/views/admin_user/show.rhtml
@@ -0,0 +1,20 @@
+<% @title = "User - " + h(@admin_user.name) %>
+
+<h1><%=@title%></h1>
+
+<p>
+<% for column in User.content_columns %>
+ <strong><%= column.human_name %>:</strong>
+ <% if column.name == 'email' %>
+ <a href="mailto:<%=h @admin_user.email %>"><%=h @admin_user.email%></a>
+ <% else %>
+ <%=h @admin_user.send(column.name) %>
+ <% end %>
+ <br>
+<% end %>
+<strong>ID:</strong> <%= @admin_user.id%>
+</p>
+
+<%= link_to 'Public page', main_url(user_url(@admin_user)) %>
+
+
diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml
index 0a1b1c298..cdbd37219 100644
--- a/app/views/layouts/admin.rhtml
+++ b/app/views/layouts/admin.rhtml
@@ -16,6 +16,7 @@
<p><b>FOIFA admin interface:</b>
<%= link_to 'Public bodies', admin_url('body/list') %>
| <%= link_to 'Requests', admin_url('request/list') %>
+| <%= link_to 'Users', admin_url('user/list') %>
</p>
<p style="color: green"><%= flash[:notice] %></p>