diff options
Diffstat (limited to 'app')
-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 |
5 files changed, 40 insertions, 3 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 %> + |