diff options
-rw-r--r-- | app/controllers/body_controller.rb | 5 | ||||
-rw-r--r-- | app/models/public_body.rb | 30 | ||||
-rw-r--r-- | app/views/body/list.rhtml | 6 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 4 |
4 files changed, 25 insertions, 20 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb index 5c06521f2..dbc6ee09c 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/body_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: body_controller.rb,v 1.9 2008-03-03 09:29:43 francis Exp $ +# $Id: body_controller.rb,v 1.10 2008-03-24 15:40:53 francis Exp $ class BodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -39,8 +39,7 @@ class BodyController < ApplicationController if @tag.nil? conditions = [] elsif @tag == 'other' - categories = PublicBody.categories_by_tag.keys - category_list = categories.map{|c| "'"+c+"'"}.join(",") + category_list = PublicBody.categories.map{|c| "'"+c+"'"}.join(",") conditions = ['(select count(*) from public_body_tags where public_body_tags.public_body_id = public_bodies.id and public_body_tags.name in (' + category_list + ')) = 0'] else diff --git a/app/models/public_body.rb b/app/models/public_body.rb index be296d659..e05215c00 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -21,7 +21,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.43 2008-03-24 14:04:15 francis Exp $ +# $Id: public_body.rb,v 1.44 2008-03-24 15:40:53 francis Exp $ require 'csv' require 'set' @@ -33,17 +33,23 @@ class PublicBody < ActiveRecord::Base has_many :info_requests has_many :public_body_tags - def self.categories_by_tag - { - "local_council" => "Local Councils", - "department" => "Ministerial Departments", - "non_ministerial_department" => "Non-Ministerial Departments", - "university" => "Universities", - "police" => "Police Forces", - "rda" => "Regional Development Agencies", - "npa" => "National Park Authorities", - "other" => "Other" - } + def self.categories_with_description + [ + [ "department", "Ministerial departments" ], + [ "local_council", "Local councils" ], + [ "non_ministerial_department", "Non-ministerial departments" ], + [ "npa", "National park authorities" ], + [ "police", "Police forces" ], + [ "rda", "Regional development agencies" ], + [ "university", "Universities" ], + [ "other", "Other" ] + ] + end + def self.categories + self.categories_with_description.map() { |a| a[0] } + end + def self.categories_by_tag + Hash[*self.categories_with_description.flatten] end def validate diff --git a/app/views/body/list.rhtml b/app/views/body/list.rhtml index 3d996d993..74144b5fb 100644 --- a/app/views/body/list.rhtml +++ b/app/views/body/list.rhtml @@ -2,7 +2,7 @@ <h1>Show only...</h1> <p> <ul> -<% for category, description in PublicBody.categories_by_tag %> +<% for category, description in PublicBody.categories_with_description %> <li> <%= link_to_unless (@tag == category), description, list_public_bodies_url(:tag => category) %> </li> @@ -11,12 +11,12 @@ </p> <p> -<a href="/help/about#missing_body">Are we missing a public body?</a> +<a href="/help/about#missing_body">Are we missing a public authority?</a> </p> </div> -<% @title = "Public bodies - " + @description %> +<% @title = "Public authorities - " + @description %> <h1><%=@title%></h1> diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index 0ce16768d..0ddb14a45 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -13,7 +13,7 @@ <% form_tag({:action => :frontpage}, :method => 'get', :id => 'public_body_form', :class => 'plaque' ) do %> <p> - <label for="public_body_query">Find the public body you would like information from:</label> + <label for="public_body_query">Find the public authority you would like information from:</label> </p> <!-- Autocomplete field, which submits form when user picks entry --> @@ -40,7 +40,7 @@ <% if @public_bodies.size > 0 %> <div id="public_body_search"> <ul> - <strong>Public bodies found</strong> + <strong>Public authorities found</strong> <% for public_body in @public_bodies %> <li> <%= link_to h(public_body.name), new_request_to_body_url(:public_body_id => public_body.id.to_s) %> |