diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/public_body.rb | 91 | ||||
-rw-r--r-- | app/views/body/list.rhtml | 20 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 4 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 2 |
4 files changed, 68 insertions, 49 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 %> |