aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2009-09-08 03:07:06 +0000
committerfrancis <francis>2009-09-08 03:07:06 +0000
commitd275d564fc3868f15a91656cbee1fe4f98d951f0 (patch)
treec5e487e2195b4c56f48de0705f81714f322422ff
parent9cee7d742d2712bb4b4a69ae57e3bfff3cf49fb3 (diff)
Move defunct out into its own tag.
-rw-r--r--app/models/public_body.rb19
-rw-r--r--app/views/admin_public_body/_form.rhtml8
2 files changed, 17 insertions, 10 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index e88a7d05e..307c7f6b5 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -26,7 +26,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.151 2009-09-08 02:47:55 francis Exp $
+# $Id: public_body.rb,v 1.152 2009-09-08 03:07:06 francis Exp $
require 'csv'
require 'set'
@@ -172,24 +172,31 @@ class PublicBody < ActiveRecord::Base
def not_apply?
return self.has_tag?('not_apply')
end
+ # If tagged "defunct", then the authority no longer exists at all
+ def defunct?
+ return self.has_tag?('defunct')
+ end
# Can an FOI (etc.) request be made to this body, and if not why not?
def is_requestable?
- if self.request_email.nil?
+ if self.defunct?
return false
end
if self.not_apply?
return false
end
- return !self.request_email.empty? && self.request_email != 'blank' && self.request_email != 'defunct'
+ if self.request_email.nil?
+ return false
+ end
+ return !self.request_email.empty? && self.request_email != 'blank'
end
def not_requestable_reason
- if self.not_apply?
+ if self.defunct?
+ return 'defunct'
+ elsif self.not_apply?
return 'not_apply'
elsif self.request_email.empty? or self.request_email == 'blank'
return 'bad_contact'
- elsif self.request_email == 'defunct'
- return 'defunct'
else
raise "requestable_failure_reason called with type that has no reason"
end
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index a7c60b819..12cb80db8 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -27,9 +27,12 @@
<p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/>
<%= text_field 'public_body', 'short_name', :size => 60 %></p>
-<p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; to <strong>defunct</strong> if the authority no longer exists; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/>
+<p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/>
<%= text_field 'public_body', 'request_email', :size => 40 %></p>
+<p><label for="public_body_tag_string">Tags <small>(space separated; see list of tags on the right; also <strong>not_apply</strong> if FOI and EIR no longer apply to authority, <strong>eir_only</strong> if EIR but not FOI applies to authority, <strong>defunct</strong> if the authority no longer exists)</small></label><br/>
+<%= text_field 'public_body', 'tag_string', :size => 60 %></p>
+
<p><label for="public_body_home_page">Home page <small>(of whole authority, not just their FOI page; set to <strong>blank</strong> (empty string) to guess it from the email)</small></label><br/>
<%= text_field 'public_body', 'home_page', :size => 60 %></p>
@@ -42,9 +45,6 @@
<p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/>
<%= text_area 'public_body', 'notes', :rows => 3, :cols => 60 %></p>
-<p><label for="public_body_tag_string">Tags <small>(space separated; see list of tags on the right; also <strong>not_apply</strong> if FOI and EIR no longer apply to authority, <strong>eir_only</strong> if EIR but not FOI applies to authority)</small></label><br/>
-<%= text_field 'public_body', 'tag_string', :size => 60 %></p>
-
<p><label for="public_body_last_edit_comment"><strong>Comment</strong> for this edit</label> <small>(put URL or other source of new info)</small><br/>
<%= text_area 'public_body', 'last_edit_comment', :rows => 3, :cols => 60 %></p>
<!--[eoform:public_body]-->