aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_public_body_controller.rb10
-rw-r--r--app/views/admin_public_body/_one_list.rhtml16
-rw-r--r--app/views/admin_public_body/list.rhtml4
3 files changed, 11 insertions, 19 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 8f51a4cfb..74a3a86c6 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.22 2009-08-26 00:45:38 francis Exp $
+# $Id: admin_public_body_controller.rb,v 1.23 2009-08-26 00:58:29 francis Exp $
class AdminPublicBodyController < AdminController
def index
@@ -17,7 +17,11 @@ class AdminPublicBodyController < AdminController
if @query == ""
@query = nil
end
- @public_bodies = PublicBody.paginate :order => "name", :page => params[:page], :per_page => 100,
+ @page = params[:page]
+ if @page == ""
+ @page = nil
+ end
+ @public_bodies = PublicBody.paginate :order => "name", :page => @page, :per_page => 100,
:conditions => @query.nil? ? nil : ["lower(name) like lower('%'||?||'%') or
lower(short_name) like lower('%'||?||'%') or
lower(request_email) like lower('%'||?||'%')", @query, @query, @query]
@@ -45,7 +49,7 @@ class AdminPublicBodyController < AdminController
flash[:notice] = "Added tag to table of bodies."
end
- redirect_to admin_url('body/list') + "?query=" + @query # XXX construct this URL properly
+ redirect_to admin_url('body/list') + "?query=" + @query + (@page.nil? ? "" : "&page=" + @page) # XXX construct this URL properly
end
def missing_scheme
diff --git a/app/views/admin_public_body/_one_list.rhtml b/app/views/admin_public_body/_one_list.rhtml
index 2797ba1eb..e0d2399d0 100644
--- a/app/views/admin_public_body/_one_list.rhtml
+++ b/app/views/admin_public_body/_one_list.rhtml
@@ -21,21 +21,9 @@
<p>
<%= text_field_tag 'new_tag', params[:new_tag], { :size => 15, :id => "mass_add_tag_new_tag_" + table_name } %>
<%= hidden_field_tag(:query, params[:query], { :id => "mass_add_tag_query_" + table_name } ) %>
+ <%= hidden_field_tag(:page, params[:page], { :id => "mass_add_page_" + table_name } ) %>
<%= hidden_field_tag(:table_name, table_name, { :id => "mass_add_tag_table_name_" + table_name } ) %>
- <%= submit_tag "Add tag to all" %> (in every page of table just above)
+ <%= submit_tag "Add tag to all" %> (in table just above)
</p>
<% end %>
-<!-- Not sure we need this remove tag option, so not coding it yet. Also worried it might be a
-bit dangerous / annoying to clear it (as search will fail so you won't even be able to see what
-you remove the tag from.
-<% if table_name == 'exact' %>
- <% form_tag(admin_url("body/mass_tag_remove"), :method => "post", :class => "forms_on_one_line" ) do %>
- <%= hidden_field_tag(:remove_tag, params[:query] ) %>
- <%= hidden_field_tag(:query, params[:query] ) %>
- <%= hidden_field_tag(:table_name, table_name ) %>
- <%= submit_tag "Remove tag '" + h(params[:query]) + "' from all" %> (that have it, i.e. in table just above)
- <% end %>
-<% end %> -->
-
-
diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml
index d8c2a1ef0..c28060604 100644
--- a/app/views/admin_public_body/list.rhtml
+++ b/app/views/admin_public_body/list.rhtml
@@ -23,7 +23,7 @@
<% if @public_bodies_by_tag.size > 0 %>
- <h2>Exact tag matches</h2>
+ <h2>Exact tag matches (<%= @public_bodies_by_tag.size %> total)</h2>
<%= render :partial => 'one_list', :locals => { :bodies => @public_bodies_by_tag, :table_name => 'exact' } %>
<% end %>
@@ -31,7 +31,7 @@
<% if @query.nil? %>
<h2>All authorities</h2>
<% else %>
- <h2>Substring search matches</h2>
+ <h2>Substring search matches (<%= @public_bodies.total_entries %> total)</h2>
<% end %>
<%= render :partial => 'one_list', :locals => { :bodies => @public_bodies, :table_name => 'substring' } %>
<% end %>