diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2012-10-17 12:53:32 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2012-10-17 14:47:55 +1100 |
commit | 05f522ecc42e106bffb1945e8e0fd1c25586f73c (patch) | |
tree | b98962500a9a4d5a5945d70a2345d7fcb163e3bc | |
parent | bb5f18ff9253b82d4402db29e24eb1359818baae (diff) |
Don't include admin authority in count on home page
-rw-r--r-- | app/models/public_body.rb | 6 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index c70aff9b9..c3bc060a4 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -42,6 +42,12 @@ class PublicBody < ActiveRecord::Base has_tag_string before_save :set_api_key, :set_default_publication_scheme + # Every public body except for the internal admin one is visible + named_scope :visible, lambda { + { + :conditions => "public_bodies.id <> #{PublicBody.internal_admin_body.id}" + } + } translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index e2d74a5e2..e7e42bb73 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -15,7 +15,7 @@ <%= _("Search over<br/> <strong>{{number_of_requests}} requests</strong> <span>and</span><br/> <strong>{{number_of_authorities}} authorities</strong>", - :number_of_requests => InfoRequest.count, :number_of_authorities => PublicBody.count) %> + :number_of_requests => InfoRequest.count, :number_of_authorities => PublicBody.visible.count) %> </h2> <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> <div> @@ -36,7 +36,7 @@ <div id="examples_0"> <h3><%= _("Who can I request information from?") %></h3> <%= _("{{site_name}} covers requests to {{number_of_authorities}} authorities, including:", - :site_name => site_name, :number_of_authorities => PublicBody.count) %> + :site_name => site_name, :number_of_authorities => PublicBody.visible.count) %> <ul> <% for popular_body in @popular_bodies %> <li><%=public_body_link(popular_body)%> |