aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_public_body_controller.rb9
-rw-r--r--app/views/admin_public_body/edit.rhtml12
-rw-r--r--app/views/admin_request/show.rhtml2
3 files changed, 16 insertions, 7 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 58432d8a9..36a310a8a 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_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: admin_public_body_controller.rb,v 1.17 2008-07-28 18:04:38 francis Exp $
+# $Id: admin_public_body_controller.rb,v 1.18 2008-08-14 08:09:39 francis Exp $
class AdminPublicBodyController < ApplicationController
layout "admin"
@@ -61,6 +61,13 @@ class AdminPublicBodyController < ApplicationController
def destroy
public_body = PublicBody.find(params[:id])
+
+ if public_body.info_requests.size > 0
+ flash[:notice] = "There are requests associated with the authority, so can't destroy it"
+ redirect_to admin_url('body/show/' + public_body.id.to_s)
+ return
+ end
+
public_body.tag_string = ""
public_body.destroy
flash[:notice] = "PublicBody was successfully destroyed."
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml
index fbc750db1..b2932f0d7 100644
--- a/app/views/admin_public_body/edit.rhtml
+++ b/app/views/admin_public_body/edit.rhtml
@@ -12,10 +12,12 @@
<%= link_to 'List all', '../list' %>
</p>
-<% form_tag('../destroy/' + @public_body.id.to_s) do %>
- <p>
- <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
- <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!)
- </p>
+<% if @public_body.info_requests.size == 0 %>
+ <% form_tag('../destroy/' + @public_body.id.to_s) do %>
+ <p>
+ <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
+ <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!)
+ </p>
+ <% end %>
<% end %>
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index d5356dd10..bef2e41de 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -109,7 +109,7 @@
<% end %>
</table>
-<h2>Comments</h2>
+<h2>Annotations</h2>
<table>
<tr>