diff options
-rw-r--r-- | app/controllers/list_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 15 | ||||
-rw-r--r-- | app/helpers/request_helper.rb | 2 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 4 | ||||
-rw-r--r-- | app/views/list/index.rhtml | 9 | ||||
-rw-r--r-- | app/views/request/index.rhtml | 14 | ||||
-rw-r--r-- | config/routes.rb | 7 | ||||
-rw-r--r-- | test/functional/request_controller_test.rb | 18 | ||||
-rw-r--r-- | todo.txt | 7 |
9 files changed, 73 insertions, 13 deletions
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 16a0d0695..117b93c7a 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -4,12 +4,12 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: list_controller.rb,v 1.1 2007-10-08 15:16:22 francis Exp $ - +# $Id: list_controller.rb,v 1.2 2007-10-09 11:30:01 francis Exp $ class ListController < ApplicationController - def index - @info_request_pages, @info_requests = paginate :info_requests, :per_page => 25 - end + def index + @info_request_pages, @info_requests = paginate :info_requests, :per_page => 25, :order => "created_at desc" + end + end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb new file mode 100644 index 000000000..b1c994531 --- /dev/null +++ b/app/controllers/request_controller.rb @@ -0,0 +1,15 @@ +# app/controllers/request_controller.rb: +# Show information about one particular request. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: request_controller.rb,v 1.1 2007-10-09 11:30:01 francis Exp $ + +class RequestController < ApplicationController + + def index + @info_request = InfoRequest.find(params[:id]) + end + +end diff --git a/app/helpers/request_helper.rb b/app/helpers/request_helper.rb new file mode 100644 index 000000000..082eb971f --- /dev/null +++ b/app/helpers/request_helper.rb @@ -0,0 +1,2 @@ +module RequestHelper +end diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 6045e5f93..3fa1884b8 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -8,7 +8,9 @@ <body> <h1 id="header">Freedom of Information Filer and Archive <span id="beta">Beta</span></h1> <ul id="navigation"> - <li>Home</li> + <li><a href="/">Home</a></li> + <li><a href="/list">All Requests</a></li> + <li><a href="/new">New Request</a></li> </ul> <% if flash[:notice] %> diff --git a/app/views/list/index.rhtml b/app/views/list/index.rhtml index 6ec13b488..617e6afbc 100644 --- a/app/views/list/index.rhtml +++ b/app/views/list/index.rhtml @@ -1,18 +1,19 @@ +<% @title = "All FOI requests" %> +<h2><%=@title%></h2> -<h1>All FOI requests</h1> - +<p. <table> <tr> <th>Title</th> - <th>Requester</th> + <th>Requester</th> <th>Created</th> </tr> <% for info_request in @info_requests %> <tr class="<%= cycle('odd', 'even') %>"> - <td><%= link_to info_request.title, :action => 'show', :id => info_request %></td> + <td><%= link_to info_request.title, :controller => 'request', :action => 'index', :id => info_request %></td> <td><%= info_request.user.name %></td> <td><%= info_request.created_at %></td> </tr> diff --git a/app/views/request/index.rhtml b/app/views/request/index.rhtml new file mode 100644 index 000000000..20ed122c3 --- /dev/null +++ b/app/views/request/index.rhtml @@ -0,0 +1,14 @@ +<% @title = @info_request.title %> + +<h2><%=@title%></h2> + +<p> +Request to <%=@info_request.public_body.name%> +</p> + +<p> +Created by <%= @info_request.user.name %></td> on <%= @info_request.created_at %> +</p> + + + diff --git a/config/routes.rb b/config/routes.rb index 034aba48a..0ea2cb946 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.8 2007-10-08 15:16:23 francis Exp $ +# $Id: routes.rb,v 1.9 2007-10-09 11:30:02 francis Exp $ ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. @@ -12,8 +12,9 @@ ActionController::Routing::Routes.draw do |map| # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action - map.connect "/new/:action", :controller => 'new', :action => 'index' - map.connect "/list/:action", :controller => 'list', :action => 'index' + map.connect "/new/:action", :controller => 'new' + map.connect "/list/:action", :controller => 'list' + map.connect "/request/:id", :controller => 'request', :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/request_controller_test.rb b/test/functional/request_controller_test.rb new file mode 100644 index 000000000..ed512c68d --- /dev/null +++ b/test/functional/request_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'request_controller' + +# Re-raise errors caught by the controller. +class RequestController; def rescue_action(e) raise e end; end + +class RequestControllerTest < Test::Unit::TestCase + def setup + @controller = RequestController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end @@ -10,6 +10,10 @@ Make it say "dear" as default letter 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 + Tidying ======= @@ -44,6 +48,9 @@ Later Read wiki page lots http://www.mysociety.org/moin.cgi/FreedomOfInformation +Check FOE site lots +http://community.foe.co.uk/tools/right_to_know/request_generator.html + Add spelling checker as in WTT For grey hints in input fields |