aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_public_body_controller.rb3
-rw-r--r--app/views/admin_public_body/list.rhtml54
2 files changed, 41 insertions, 16 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index e8ee58f95..b0cdcac78 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.14 2008-05-21 22:37:32 francis Exp $
+# $Id: admin_public_body_controller.rb,v 1.15 2008-05-26 12:25:36 francis Exp $
class AdminPublicBodyController < ApplicationController
layout "admin"
@@ -21,6 +21,7 @@ class AdminPublicBodyController < ApplicationController
:conditions => @query.nil? ? nil : ["name ilike '%'||?||'%' or
short_name ilike '%'||?||'%' or
request_email ilike '%'||?||'%'", @query, @query, @query]
+ @public_bodies_by_tag = PublicBody.find_by_tag(@query)
end
def show
diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml
index a6b2dd65c..56dfa4889 100644
--- a/app/views/admin_public_body/list.rhtml
+++ b/app/views/admin_public_body/list.rhtml
@@ -10,25 +10,49 @@
<% form_tag("", :method => "get") do %>
<p>
<%= text_field_tag 'query', params[:query], { :size => 30 } %>
- <%= submit_tag "Search" %> (substring search, names and emails)
+ <%= submit_tag "Search" %> (substring search in names and emails; exact match of tags)
</p>
<% end %>
-<table>
- <tr>
- <% for column in PublicBody.content_columns.map { |c| c.human_name } - [ "Last edit comment" ] %>
- <th><%= column %></th>
- <% end %>
- </tr>
-
-<% for public_body in @public_bodies %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%= link_to h(public_body.name), 'show/' + public_body.id.to_s %></td>
- <% for column in PublicBody.content_columns.map { |c| c.name } - [ "name", "last_edit_comment" ] %>
- <td><%=h public_body.send(column) %></td>
- <% end %>
- </tr>
+
+<% if @public_bodies_by_tag.size > 0 %>
+ <h2>Exact tag matches</h2>
+ <table>
+ <tr>
+ <% for column in PublicBody.content_columns.map { |c| c.human_name } - [ "Last edit comment" ] %>
+ <th><%= column %></th>
+ <% end %>
+ </tr>
+ <% for public_body in @public_bodies_by_tag %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= link_to h(public_body.name), 'show/' + public_body.id.to_s %></td>
+ <% for column in PublicBody.content_columns.map { |c| c.name } - [ "name", "last_edit_comment" ] %>
+ <td><%=h public_body.send(column) %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+<% end %>
+
+<% if @public_bodies.size > 0 %>
+ <h2>Substring search matches</h2>
+ <table>
+ <tr>
+ <% for column in PublicBody.content_columns.map { |c| c.human_name } - [ "Last edit comment" ] %>
+ <th><%= column %></th>
+ <% end %>
+ </tr>
+ <% for public_body in @public_bodies %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= link_to h(public_body.name), 'show/' + public_body.id.to_s %></td>
+ <% for column in PublicBody.content_columns.map { |c| c.name } - [ "name", "last_edit_comment" ] %>
+ <td><%=h public_body.send(column) %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
<% end %>
+
</table>
<%= will_paginate(@public_bodies) %>