diff options
-rw-r--r-- | app/controllers/admin_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/admin_public_body_controller.rb | 10 | ||||
-rw-r--r-- | app/helpers/admin_helper.rb | 2 | ||||
-rw-r--r-- | app/views/admin/index.rhtml | 3 | ||||
-rw-r--r-- | app/views/admin_public_body/list.rhtml | 4 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml (renamed from app/views/layouts/admin_public_body.rhtml) | 6 | ||||
-rw-r--r-- | config/routes.rb | 7 | ||||
-rw-r--r-- | test/functional/admin_controller_test.rb | 18 | ||||
-rw-r--r-- | todo.txt | 1 |
9 files changed, 57 insertions, 6 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb new file mode 100644 index 000000000..7bb60b036 --- /dev/null +++ b/app/controllers/admin_controller.rb @@ -0,0 +1,12 @@ +# app/controllers/admin_public_body_controller.rb: +# Controller for admin interface. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: admin_controller.rb,v 1.1 2007-09-03 09:39:20 francis Exp $ + +class AdminController < ApplicationController + layout "admin" +end + diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index a982857c0..5f462a2ba 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -1,4 +1,14 @@ +# app/controllers/admin_public_body_controller.rb: +# Controller for editing public bodies 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_public_body_controller.rb,v 1.2 2007-09-03 09:39:20 francis Exp $ + class AdminPublicBodyController < ApplicationController + layout "admin" + def index list render :action => 'list' diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb new file mode 100644 index 000000000..d5c6d3555 --- /dev/null +++ b/app/helpers/admin_helper.rb @@ -0,0 +1,2 @@ +module AdminHelper +end diff --git a/app/views/admin/index.rhtml b/app/views/admin/index.rhtml new file mode 100644 index 000000000..13cc52554 --- /dev/null +++ b/app/views/admin/index.rhtml @@ -0,0 +1,3 @@ +<!-- nothing here yet, just show navigation --> + + diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml index ec1c5c431..006ca862c 100644 --- a/app/views/admin_public_body/list.rhtml +++ b/app/views/admin_public_body/list.rhtml @@ -1,4 +1,4 @@ -<h1>Listing public_bodies</h1> +<h1>Listing public bodies</h1> <table> <tr> @@ -24,4 +24,4 @@ <br /> -<%= link_to 'New public_body', :action => 'new' %> +<%= link_to 'New public body', :action => 'new' %> diff --git a/app/views/layouts/admin_public_body.rhtml b/app/views/layouts/admin.rhtml index 18d3caa61..947e65d33 100644 --- a/app/views/layouts/admin_public_body.rhtml +++ b/app/views/layouts/admin.rhtml @@ -4,11 +4,15 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> - <title>AdminPublicBody: <%= controller.action_name %></title> + <title>FOIFA admin: <%=controller.controller_name %> <%= controller.action_name %></title> <%= stylesheet_link_tag 'scaffold' %> </head> <body> +<p><b>FOIFA admin interface:</b> +<%= link_to 'Public bodies', :controller => 'admin_public_body', :action => 'list' %> +</p> + <p style="color: green"><%= flash[:notice] %></p> <%= yield %> diff --git a/config/routes.rb b/config/routes.rb index 63dfd665e..906466a19 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.5 2007-08-29 12:12:45 francis Exp $ +# $Id: routes.rb,v 1.6 2007-09-03 09:39:21 francis Exp $ ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. @@ -13,9 +13,12 @@ ActionController::Routing::Routes.draw do |map| # 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 => 'file_request', :action => 'index' - map.connect "/:action/:id", :controller => 'frontpage' + + map.connect '/admin/:action', :controller => 'admin', :action => 'index' map.connect '/admin/body/:action/:id', :controller => 'admin_public_body' + map.connect "/:action/:id", :controller => 'frontpage' + # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb new file mode 100644 index 000000000..e44ac9423 --- /dev/null +++ b/test/functional/admin_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'admin_controller' + +# Re-raise errors caught by the controller. +class AdminController; def rescue_action(e) raise e end; end + +class AdminControllerTest < Test::Unit::TestCase + def setup + @controller = AdminController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end @@ -5,7 +5,6 @@ Fix up how we do HTML 4.0 Public body ----------- -Put links from front admin page Log user who made change to public body Display history of public body in admin |