diff options
-rw-r--r-- | app/controllers/admin_request_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin_user_controller.rb | 28 | ||||
-rw-r--r-- | app/helpers/link_to_helper.rb | 4 | ||||
-rw-r--r-- | app/views/admin_user/list.rhtml | 28 | ||||
-rw-r--r-- | app/views/admin_user/show.rhtml | 20 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 1 | ||||
-rw-r--r-- | config/routes.rb | 3 | ||||
-rw-r--r-- | todo.txt | 25 |
8 files changed, 92 insertions, 21 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> diff --git a/config/routes.rb b/config/routes.rb index 9687fad70..c54f68681 100644 --- a/config/routes.rb +++ b/config/routes.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: routes.rb,v 1.29 2008-01-18 03:30:22 francis Exp $ +# $Id: routes.rb,v 1.30 2008-01-22 18:34:17 francis Exp $ ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. @@ -41,6 +41,7 @@ ActionController::Routing::Routes.draw do |map| map.connect '/admin/:action', :controller => 'admin', :action => 'index' map.connect '/admin/body/:action/:id', :controller => 'admin_public_body' map.connect '/admin/request/:action/:id', :controller => 'admin_request' + map.connect '/admin/user/:action/:id', :controller => 'admin_user' # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' @@ -61,25 +61,25 @@ Brainstorm of things to say if c): d) My request was explicitly rejected -Next -==== - -Use sent again date when there has been resent?, e.g. for - http://foi.mysociety.org/request/16 +Status of messages stuff +======================== Followups: - link to the follow up form, or embed in bottom of main request page - don't show classify link on /response/ page -Alert somewhere if working days table not up to date + +Use sent again date when there has been resent?, e.g. for + http://foi.mysociety.org/request/16 Show due date on, e.g. http://foi.mysociety.org/request/4 Sort by due date, show categorisation everywhere +Alert somewhere if working days table not up to date Sort the requests by when something last happened to them (this needs thought as to what sort orders we need) -Check out all automatically things here: +Make sure this page is OK http://foi.mysociety.org/request/14 Tidying @@ -92,12 +92,8 @@ Test that it is actually sending the request outgoing mail, by using deliveries Add fixtures for info_request_event Test sending a message to bounce/envelope-from address -Add display of users to admin interface (so can find their email address out) Link internally between different bits of admin interface -Bubbles don't validate -http://localhost:3000/request/5 - Add SQL database indexes to token / email_token in post_redirects Set "null" and "default" options more in schema @@ -109,11 +105,6 @@ Add SQL foreign keys to database schema (THIS IS IMPORTANT, or things will screw http://rubyforge.org/projects/mig-constraints/ Call "delete from sessions where now() - updated_at > 3600" (one hour) or whatever -404s on all invalid URL parameters -Hook global error message also - -Check log rotation is working well - Mark some requests as test requests @@ -218,6 +209,8 @@ the last > converted to > too badly http://localhost:3000/request/5? (and be sure if you use a hack with a secret, it really is secret to stop people making evil links) +Check log rotation is working well + Sources of public bodies ======================== |