diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_controller.rb | 8 | ||||
-rw-r--r-- | app/views/admin/debug.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin/index.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin/stats.rhtml | 29 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 12 |
5 files changed, 46 insertions, 7 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 64f367b92..ebd4beab6 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.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: admin_controller.rb,v 1.11 2008-04-11 16:10:12 francis Exp $ +# $Id: admin_controller.rb,v 1.12 2008-04-16 13:23:55 francis Exp $ class AdminController < ApplicationController layout "admin" @@ -47,6 +47,12 @@ class AdminController < ApplicationController @events.sort! { |a,b| b.created_at <=> a.created_at } end + def stats + @request_by_state = InfoRequest.count(:group => 'described_state') + @tracks_by_type = TrackThing.count(:group => 'track_type') + @tracks_by_medium = TrackThing.count(:group => 'track_medium') + end + def debug @request_env = request.env end diff --git a/app/views/admin/debug.rhtml b/app/views/admin/debug.rhtml index 8a3fcc895..918c28486 100644 --- a/app/views/admin/debug.rhtml +++ b/app/views/admin/debug.rhtml @@ -2,6 +2,8 @@ <h1><%=@title%></h1> +<p>You are <%= h @http_auth_user %></p> + <h2>Environment variables</h2> <pre> <%= @request_env.to_yaml %> diff --git a/app/views/admin/index.rhtml b/app/views/admin/index.rhtml index c356b5994..6f1550d7b 100644 --- a/app/views/admin/index.rhtml +++ b/app/views/admin/index.rhtml @@ -1,4 +1,4 @@ -<% @title = "Overview" %> +<% @title = "Summary" %> <h1><%=@title%></h1> diff --git a/app/views/admin/stats.rhtml b/app/views/admin/stats.rhtml new file mode 100644 index 000000000..9bca62079 --- /dev/null +++ b/app/views/admin/stats.rhtml @@ -0,0 +1,29 @@ +<% @title = "Statistics" %> + +<h1>Statistics</h1> + +<h2>State of requests</h2> + +<table> +<% for state, count in @request_by_state %> +<tr> <td><%=state %></td><td><%= count %></td> </tr> +<% end %> +</table> + +<h2>Tracks by type</h2> + +<table> +<% for state, count in @tracks_by_type %> +<tr> <td><%=state %></td><td><%= count %></td> </tr> +<% end %> +</table> + +<h2>Tracks by medium</h2> + +<table> +<% for state, count in @tracks_by_medium %> +<tr> <td><%=state %></td><td><%= count %></td> </tr> +<% end %> +</table> + + diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index b9b362332..9184cbda7 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -10,14 +10,16 @@ </head> <body> - <p><strong><%= link_to 'WhatDoTheyKnow', main_url('/') %> admin interface:</strong> - <%= link_to 'Overview', admin_url('') %> + <p> + <strong><%= link_to 'WhatDoTheyKnow', main_url('/') %> admin:</strong> + <%= link_to 'Summary', admin_url('') %> | <%= link_to 'Timeline', admin_url('timeline') %> - | <%= link_to 'Public authorities', admin_url('body/list') %> + | <%= link_to 'Stats', admin_url('stats') %> + | <%= link_to 'Debug', admin_url('debug') %> + <strong>View:</strong> + <%= link_to 'Authorities', admin_url('body/list') %> | <%= link_to 'Requests', admin_url('request/list') %> | <%= link_to 'Users', admin_url('user/list') %> - | <%= link_to 'Debug', admin_url('debug') %> - - you are <%= h @http_auth_user %> </p> <% if flash[:notice] %> |