diff options
-rw-r--r-- | app/controllers/user_controller.rb | 15 | ||||
-rw-r--r-- | app/helpers/user_helper.rb | 2 | ||||
-rw-r--r-- | app/views/list/index.rhtml | 4 | ||||
-rw-r--r-- | app/views/request/index.rhtml | 4 | ||||
-rw-r--r-- | app/views/user/index.rhtml | 18 | ||||
-rw-r--r-- | config/routes.rb | 3 | ||||
-rw-r--r-- | test/functional/user_controller_test.rb | 18 | ||||
-rw-r--r-- | todo.txt | 5 |
8 files changed, 65 insertions, 4 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb new file mode 100644 index 000000000..3875bf745 --- /dev/null +++ b/app/controllers/user_controller.rb @@ -0,0 +1,15 @@ +# app/controllers/user_controller.rb: +# Show information about a user. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: user_controller.rb,v 1.1 2007-10-09 17:12:11 francis Exp $ + +class UserController < ApplicationController + + def index + @display_users = User.find(:all, :conditions => [ "name = ?", params[:name] ]) + end + +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb new file mode 100644 index 000000000..0147c3fe6 --- /dev/null +++ b/app/helpers/user_helper.rb @@ -0,0 +1,2 @@ +module UserHelper +end diff --git a/app/views/list/index.rhtml b/app/views/list/index.rhtml index 617e6afbc..59c156833 100644 --- a/app/views/list/index.rhtml +++ b/app/views/list/index.rhtml @@ -2,7 +2,7 @@ <h2><%=@title%></h2> -<p. +<p> <table> <tr> <th>Title</th> @@ -14,7 +14,7 @@ <% for info_request in @info_requests %> <tr class="<%= cycle('odd', 'even') %>"> <td><%= link_to info_request.title, :controller => 'request', :action => 'index', :id => info_request %></td> - <td><%= info_request.user.name %></td> + <td><%= link_to info_request.user.name, :controller => 'user', :action => 'index', :name => info_request.user.name %></td> <td><%= info_request.created_at %></td> </tr> <% end %> diff --git a/app/views/request/index.rhtml b/app/views/request/index.rhtml index 20ed122c3..8c6f9d9b4 100644 --- a/app/views/request/index.rhtml +++ b/app/views/request/index.rhtml @@ -7,7 +7,9 @@ Request to <%=@info_request.public_body.name%> </p> <p> -Created by <%= @info_request.user.name %></td> on <%= @info_request.created_at %> +Created by +<%= link_to @info_request.user.name, :controller => 'user', :action => 'index', :name => @info_request.user.name %> +on <%= @info_request.created_at %> </p> diff --git a/app/views/user/index.rhtml b/app/views/user/index.rhtml new file mode 100644 index 000000000..77f443463 --- /dev/null +++ b/app/views/user/index.rhtml @@ -0,0 +1,18 @@ +<% @title = @display_users[0].name %> + +<% if (@display_users.size > 1) %> + <p>There is more than one user with this name. +<% end%> + +<% for display_user in @display_users %> + <h2><%=@title%></h2> + + <p>Registered <%= display_user.created_at %></p> + <p>Freedom of Information requests made by this person:</p> + <ul> + <% for info_request in display_user.info_requests %> + <li><%= link_to info_request.title, :controller => 'request', :action => 'index', :id => info_request %></td> + <% end %> + </ul> +<% end %> + diff --git a/config/routes.rb b/config/routes.rb index 0ea2cb946..037d55f0a 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.9 2007-10-09 11:30:02 francis Exp $ +# $Id: routes.rb,v 1.10 2007-10-09 17:12:12 francis Exp $ ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. @@ -15,6 +15,7 @@ ActionController::Routing::Routes.draw do |map| map.connect "/new/:action", :controller => 'new' map.connect "/list/:action", :controller => 'list' map.connect "/request/:id", :controller => 'request', :action => 'index' + map.connect "/user/:name", :controller => 'user', :action => 'index' map.connect '/admin/:action', :controller => 'admin', :action => 'index' map.connect '/admin/body/:action/:id', :controller => 'admin_public_body' diff --git a/test/functional/user_controller_test.rb b/test/functional/user_controller_test.rb new file mode 100644 index 000000000..b97a404ac --- /dev/null +++ b/test/functional/user_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'user_controller' + +# Re-raise errors caught by the controller. +class UserController; def rescue_action(e) raise e end; end + +class UserControllerTest < Test::Unit::TestCase + def setup + @controller = UserController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end @@ -13,6 +13,9 @@ Write some tests (try it their way, at every level) Link to user pages Check all controllers to be sure non-action functions are private +You have a zillion CSS holes - run h() more + +Format dates nicely Tidying ======= @@ -56,6 +59,8 @@ Add spelling checker as in WTT For grey hints in input fields http://pauldowman.com/projects/fieldhints/ +Somehow validate all pages with HTML validate + Sources of public bodies ======================== |