aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/public_body.rb91
-rw-r--r--app/views/body/list.rhtml20
-rw-r--r--app/views/general/frontpage.rhtml4
-rw-r--r--app/views/layouts/default.rhtml2
-rw-r--r--db/schema.rb42
5 files changed, 90 insertions, 69 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 778e9cda9..59ce863d9 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.89 2008-07-29 22:38:05 francis Exp $
+# $Id: public_body.rb,v 1.90 2008-07-31 00:22:52 francis Exp $
require 'csv'
require 'set'
@@ -38,49 +38,58 @@ class PublicBody < ActiveRecord::Base
has_many :info_requests, :order => 'created_at desc'
has_many :public_body_tags
- def self.categories_with_description
+ def self.categories_with_headings
[
- # Central government
- [ "department", "Ministerial departments", "a ministerial department" ],
- [ "non_ministerial_department", "Non-ministerial departments", "a non-ministerial department" ],
- [ "executive_agency", "Executive agencies", "an executive agency" ],
- [ "government_office", "Government offices for the regions", "a government office for the regions"],
- [ "advisory_committee", "Advisory committees", "an advisory committee"],
- [ "awc", "Agricultural wages committee", "an agriculatural wages committee"],
- [ "adhac", "Agricultural dwelling house advisory committees", "an agriculatural dwelling house advisory committee" ],
- # Countries, regional, local
- [ "local_council", "Local councils", "a local council" ],
- [ "regional_assembly", "Regional assemblies", "a regional assembly"],
- [ "nsbody", "North/south bodies", "a north/south body"],
- [ "rda", "Regional development agencies", "a regional development agency" ],
- # Environment
- [ "npa", "National park authorities", "a national park authority" ],
- [ "sea_fishery_committee", "Sea fisheries committees", "a sea fisheries committee" ],
- [ "watercompanies", "Water companies", "a water company" ],
- [ "npte", "Passenger transport executives", "a passenger transport executive" ],
- [ "idb", "Internal drainage boards", "an internal drainage board" ],
- [ "rfdc", "Regional flood defence committees", "a regional flood defence committee" ],
- # Media, arts
- [ "media", "Media", "a media organisation" ],
- [ "museum", "Museums and galleries", "a museum or gallery" ],
- # Home office
- [ "police", "Police forces", "a police force" ],
- [ "police_authority", "Police authorities", "a police authority" ],
- # Health
- [ "nhstrust", "NHS trusts", "an NHS trust" ],
- [ "sha", "Strategic health authorities", "a strategic health authority" ],
- [ "pct", "Primary care trusts", "a primary care trust" ],
- [ "nhswales", "NHS in Wales", "part of the NHS in Wales" ],
- [ "nhsni", "NHS in Northern Ireland", "part of the NHS in Northern Ireland" ],
- [ "hscr", "Health / social care", "Relating to health / social care" ],
- # Education
- [ "university", "Universities", "a university" ],
- [ "hei", "Higher education institutions", "a higher educational institution" ],
- [ "fei", "Further education institutions", "a further educational institution" ],
- # Other
- [ "other", "Other", "other" ]
+ "Miscellaneous",
+ [ "other", "Miscellaneous", "miscellaneous" ],
+ "Central government",
+ [ "department", "Ministerial departments", "a ministerial department" ],
+ [ "non_ministerial_department", "Non-ministerial departments", "a non-ministerial department" ],
+ [ "executive_agency", "Executive agencies", "an executive agency" ],
+ [ "government_office", "Government offices for the regions", "a government office for the regions" ],
+ [ "advisory_committee", "Advisory committees", "an advisory committee" ],
+ [ "awc", "Agricultural wages committees", "an agriculatural wages committee" ],
+ [ "adhac", "Agricultural dwelling house advisory committees", "an agriculatural dwelling house advisory committee" ],
+ "Local and regional",
+ [ "local_council", "Local councils", "a local council" ],
+ [ "regional_assembly", "Regional assemblies", "a regional assembly"],
+ [ "nsbody", "North/south bodies", "a north/south body"],
+ [ "rda", "Regional development agencies", "a regional development agency" ],
+ "Education",
+ [ "university", "Universities", "a university" ],
+ [ "hei", "Higher education institutions", "a higher educational institution" ],
+ [ "fei", "Further education institutions", "a further educational institution" ],
+ [ "research_council", "Research councils", "a research council" ],
+ [ "lib_board", "Education and library boards", "an education and library board" ],
+ "Environment",
+ [ "npa", "National park authorities", "a national park authority" ],
+ [ "sea_fishery_committee", "Sea fisheries committees", "a sea fisheries committee" ],
+ [ "watercompanies", "Water companies", "a water company" ],
+ [ "idb", "Internal drainage boards", "an internal drainage board" ],
+ [ "rfdc", "Regional flood defence committees", "a regional flood defence committee" ],
+ [ "zoo", "Zoos", "a zoo" ],
+ "Health",
+ [ "nhstrust", "NHS trusts", "an NHS trust" ],
+ [ "sha", "Strategic health authorities", "a strategic health authority" ],
+ [ "pct", "Primary care trusts", "a primary care trust" ],
+ [ "nhswales", "NHS in Wales", "part of the NHS in Wales" ],
+ [ "nhsni", "NHS in Northern Ireland", "part of the NHS in Northern Ireland" ],
+ [ "hscr", "Health / social care", "Relating to health / social care" ],
+ "Media and culture",
+ [ "media", "Media", "a media organisation" ],
+ [ "museum", "Museums and galleries", "a museum or gallery" ],
+ "Police and courts",
+ [ "police", "Police forces", "a police force" ],
+ [ "police_authority", "Police authorities", "a police authority" ],
+ [ "dpp", "District policing partnerships", "a district policing partnership" ],
+ [ "rules_committee", "Rules commitees", "a rules committee" ],
+ "Transport",
+ [ "npte", "Passenger transport executives", "a passenger transport executive" ],
]
end
+ def self.categories_with_description
+ self.categories_with_headings.select() { |a| a.instance_of?(Array) }
+ end
def self.categories
self.categories_with_description.map() { |a| a[0] }
end
diff --git a/app/views/body/list.rhtml b/app/views/body/list.rhtml
index 1add37e24..ac713ede4 100644
--- a/app/views/body/list.rhtml
+++ b/app/views/body/list.rhtml
@@ -1,10 +1,20 @@
<div id="body_sidebar">
<h1>Show only...</h1>
-<ul>
-<% for category, description in PublicBody.categories_with_description %>
-<li>
- <%= link_to_unless (@tag == category), description, list_public_bodies_url(:tag => category) %>
-</li>
+<% first_row = true %>
+<% for row in PublicBody.categories_with_headings %>
+ <% if row.instance_of?(Array) %>
+ <li>
+ <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_url(:tag => row[0]) %>
+ </li>
+ <% else %>
+ <% if not first_row %>
+ </ul>
+ <% else %>
+ <% first_row = false %>
+ <% end %>
+ <h2><%=h row%></h2>
+ <ul>
+ <% end %>
<% end %>
</ul>
<p>
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index 83fa6cf0c..121758bbe 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -4,7 +4,7 @@
<% if @public_bodies.size == 0 and @query_made %>
<div id="error">
Sorry! We couldn't find any public authorities with that in their names.
- Either <a href="/body/list/department">browse them all</a> or
+ Either <a href="/body/list/other">browse them all</a> or
<a href="/help/about#missing_body">help us add it</a>.
</div>
<% end %>
@@ -49,7 +49,7 @@
<% end %>
<p>
- Can't find it? <a href="/body/list/department">Browse all</a> or <a href="/help/about#missing_body">ask us to add it</a>.
+ Can't find it? <a href="/body/list/other">Browse all</a> or <a href="/help/about#missing_body">ask us to add it</a>.
</p>
<% end %>
</div>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 2e2ab15fb..564903f0d 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -43,7 +43,7 @@
<ul id="navigation">
<li><a href="/">Make request</a></li>
<li><%= link_to "View requests", request_list_url(:view => nil) %></li>
- <li><%= link_to "View authorities", list_public_bodies_url(:tag => 'department') %></li>
+ <li><%= link_to "View authorities", list_public_bodies_url(:tag => 'other') %></li>
<% if @user %>
<li><%=link_to "My requests", user_url(@user) %></li>
<% end %>
diff --git a/db/schema.rb b/db/schema.rb
index 25b4fa7cc..3212913c8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -54,9 +54,9 @@ ActiveRecord::Schema.define(:version => 60) do
t.string "law_used", :default => "foi", :null => false
end
- add_index "info_requests", ["url_title"], :name => "index_info_requests_on_url_title", :unique => true
- add_index "info_requests", ["title"], :name => "index_info_requests_on_title"
add_index "info_requests", ["created_at"], :name => "index_info_requests_on_created_at"
+ add_index "info_requests", ["title"], :name => "index_info_requests_on_title"
+ add_index "info_requests", ["url_title"], :name => "index_info_requests_on_url_title", :unique => true
create_table "outgoing_messages", :force => true do |t|
t.integer "info_request_id", :null => false
@@ -81,22 +81,22 @@ ActiveRecord::Schema.define(:version => 60) do
t.text "circumstance", :default => "normal", :null => false
end
- add_index "post_redirects", ["updated_at"], :name => "index_post_redirects_on_updated_at"
- add_index "post_redirects", ["token"], :name => "index_post_redirects_on_token"
add_index "post_redirects", ["email_token"], :name => "index_post_redirects_on_email_token"
+ add_index "post_redirects", ["token"], :name => "index_post_redirects_on_token"
+ add_index "post_redirects", ["updated_at"], :name => "index_post_redirects_on_updated_at"
create_table "public_bodies", :force => true do |t|
- t.text "name", :null => false
- t.text "short_name", :null => false
- t.text "request_email", :null => false
- t.integer "version", :null => false
- t.string "last_edit_editor", :null => false
- t.text "last_edit_comment", :limit => 255, :null => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "url_name", :null => false
- t.text "home_page", :default => "", :null => false
- t.text "notes", :default => "", :null => false
+ t.text "name", :null => false
+ t.text "short_name", :null => false
+ t.text "request_email", :null => false
+ t.integer "version", :null => false
+ t.string "last_edit_editor", :null => false
+ t.text "last_edit_comment", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "url_name", :null => false
+ t.text "home_page", :default => "", :null => false
+ t.text "notes", :default => "", :null => false
end
add_index "public_bodies", ["url_name"], :name => "index_public_bodies_on_url_name", :unique => true
@@ -117,20 +117,20 @@ ActiveRecord::Schema.define(:version => 60) do
t.text "request_email"
t.datetime "updated_at"
t.string "last_edit_editor"
- t.text "last_edit_comment", :limit => 255
+ t.text "last_edit_comment"
t.text "url_name"
t.text "home_page"
t.text "notes"
end
create_table "track_things", :force => true do |t|
- t.integer "tracking_user_id", :null => false
- t.string "track_query", :null => false
+ t.integer "tracking_user_id", :null => false
+ t.string "track_query", :null => false
t.integer "info_request_id"
t.integer "tracked_user_id"
t.integer "public_body_id"
- t.string "track_medium", :null => false
- t.string "track_type", :default => "internal_error", :null => false
+ t.string "track_medium", :null => false
+ t.string "track_type", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -153,6 +153,8 @@ ActiveRecord::Schema.define(:version => 60) do
t.integer "info_request_event_id"
end
+ add_index "user_info_request_sent_alerts", ["user_id", "info_request_id", "alert_type"], :name => "user_info_request_sent_alerts_unique_index", :unique => true
+
create_table "users", :force => true do |t|
t.string "email", :null => false
t.string "name", :null => false