aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb10
-rw-r--r--app/models/public_body.rb12
-rw-r--r--app/views/admin_public_body/_form.rhtml2
-rw-r--r--app/views/body/show.rhtml30
-rw-r--r--app/views/request/new.rhtml4
-rw-r--r--app/views/request/new_bad_contact.rhtml2
-rw-r--r--app/views/request/new_not_apply.rhtml15
7 files changed, 43 insertions, 32 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index ea0fb7058..8316eebf3 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_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: request_controller.rb,v 1.159 2009-05-11 13:06:33 tony Exp $
+# $Id: request_controller.rb,v 1.160 2009-06-12 13:53:45 francis Exp $
class RequestController < ApplicationController
@@ -155,7 +155,13 @@ class RequestController < ApplicationController
if @info_request.public_body.is_requestable?
render :action => 'new'
else
- render :action => 'new_' + @info_request.public_body.not_requestable_reason
+ if @info_request.public_body.not_requestable_reason == 'bad_contact'
+ render :action => 'new_bad_contact'
+ else
+ # if not requestable because defunct or not_apply, redirect to main page
+ # (which doesn't link to the /new/ URL)
+ redirect_to public_body_url(@info_request.public_body)
+ end
end
end
return
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 6d93d4c60..8d3b71b95 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.142 2009-04-23 10:22:10 francis Exp $
+# $Id: public_body.rb,v 1.143 2009-06-12 13:53:45 francis Exp $
require 'csv'
require 'set'
@@ -170,13 +170,15 @@ class PublicBody < ActiveRecord::Base
if self.request_email.nil?
return false
end
- return !self.request_email.empty? && self.request_email != 'blank' && self.request_email != 'not_apply'
+ return !self.request_email.empty? && self.request_email != 'blank' && self.request_email != 'not_apply' && self.request_email != 'defunct'
end
def not_requestable_reason
if self.request_email.empty? or self.request_email == 'blank'
return 'bad_contact'
elsif self.request_email == 'not_apply'
return 'not_apply'
+ elsif self.request_email == 'defunct'
+ return 'defunct'
else
raise "requestable_failure_reason called with type that has no reason"
end
@@ -486,6 +488,12 @@ class PublicBody < ActiveRecord::Base
self.versions.sort { |a,b| a.version <=> b.version }
end
+ def has_notes?
+ return self.notes != ""
+ end
+ def notes_as_html
+ MySociety::Format.make_clickable(self.notes)
+ end
end
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index f77ffed95..a8dbb1d29 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -27,7 +27,7 @@
<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>not_apply</strong> if FOI no longer / never did apply to authority; 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; to <strong>not_apply</strong> if FOI no longer / never did apply to authority; 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/>
<%= text_field 'public_body', 'request_email', :size => 40 %></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/>
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml
index d95862239..4c9df8646 100644
--- a/app/views/body/show.rhtml
+++ b/app/views/body/show.rhtml
@@ -25,8 +25,8 @@
<% end %>
</p>
-<% if @public_body.notes != "" %>
- <p><%=MySociety::Format.make_clickable(@public_body.notes) %></p>
+<% if @public_body.has_notes? && (@public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact') %>
+ <p><%= @public_body.notes_as_html %></p>
<% end %>
<% if @public_body.eir_only? %>
@@ -34,13 +34,25 @@
<% end %>
<div id="stepwise_make_request">
- <strong>Next,
- <% if @public_body.eir_only? %>
- <%= link_to "make a new EIR request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%>
- <% else %>
- <%= link_to "make a new FOI request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%>
- <% end %>
- to <%= h(@public_body.name) %>
+ <strong>
+ <% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
+ Next,
+ <% if @public_body.eir_only? %>
+ <%= link_to "make a new EIR request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%>
+ <% else %>
+ <%= link_to "make a new FOI request", new_request_to_body_url(:public_body_id => @public_body.id.to_s)%>
+ <% end %>
+ to <%= h(@public_body.name) %>
+ <% elsif @public_body.has_notes? %>
+ <%= @public_body.notes_as_html %>
+ <% elsif @public_body.not_requestable_reason == 'not_apply' %>
+ Freedom of Information law does not apply to this authority, so you cannot make
+ a request to it.
+ <% elsif @public_body.not_requestable_reason == 'defunct' %>
+ This authority no longer exists, so you cannot make a request to it.
+ <% else %>
+ For an unknown reason, it is not possible to make a request to this authority.
+ <% end %>
</strong>
</div>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 9fdb38876..fc3288bdc 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -54,10 +54,10 @@
<li>This site is <strong>public</strong>. Everything you type and any response will be published.</li>
</ul>
- <% if @info_request.public_body.notes != "" %>
+ <% if @info_request.public_body.has_notes? %>
<h1>Special note for this authority!</h1>
<ul>
- <li><%=MySociety::Format.make_clickable(@info_request.public_body.notes) %></li>
+ <li><p><%= @info_request.public_body.notes_as_html %></p></li>
</ul>
<% end %>
diff --git a/app/views/request/new_bad_contact.rhtml b/app/views/request/new_bad_contact.rhtml
index c1433fee6..86dac9899 100644
--- a/app/views/request/new_bad_contact.rhtml
+++ b/app/views/request/new_bad_contact.rhtml
@@ -4,7 +4,7 @@
<p>Unfortunately, we do not have a working <%=h @info_request.law_used_full %>
address for <%=h @info_request.public_body.name %>. You may be able to find
-one on their website, or by phoning them up and asking. If you mange
+one on their website, or by phoning them up and asking. If you manage
to find one, then please <a href="/help/contact">send it to us</a>.
</p>
diff --git a/app/views/request/new_not_apply.rhtml b/app/views/request/new_not_apply.rhtml
deleted file mode 100644
index 1b5ff504f..000000000
--- a/app/views/request/new_not_apply.rhtml
+++ /dev/null
@@ -1,15 +0,0 @@
-<% @title = "Freedom of Information law does not apply to '" + h(@info_request.public_body.name) + "'" %>
-
-<h1><%=@title%></h1>
-
-<p>Unfortunately, Freedom of Information law does not apply to
-<%=h @info_request.public_body.name %>. It appears on this
-site because we either incorrectly added it, or FOI
-used to apply to it but doesn't any more.
-</p>
-
-<p>Perhaps you can get the same information by making a request
-to a Government department relevant to <%=h @info_request.public_body.name %>,
-or to another public authority with whom they have links.
-</p>
-