aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-05-29 15:15:08 +0100
committerLouise Crow <louise.crow@gmail.com>2013-05-29 15:15:08 +0100
commitbbd4fb3ccb72cdb938cd17859348b28fcc0caa78 (patch)
tree4cb757eb463eb74eaec182963f28484cedaaf355
parent16c075c68159ef79dd196196a4171f54934f9c41 (diff)
Render the public body results when selecting an authority with the same template, whether they are loaded via ajax or not. Fixes #962.
-rw-r--r--app/views/public_body/_search_ahead.html.erb5
-rw-r--r--app/views/request/select_authority.html.erb21
2 files changed, 4 insertions, 22 deletions
diff --git a/app/views/public_body/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb
index b1af2464d..3d1dc8f93 100644
--- a/app/views/public_body/_search_ahead.html.erb
+++ b/app/views/public_body/_search_ahead.html.erb
@@ -1,4 +1,4 @@
-<div>
+
<% if !@xapian_requests.nil? %>
<% if @xapian_requests.results.size > 0 %>
<h3><%= _('Top search results:') %></h3>
@@ -10,12 +10,11 @@
<% end %>
<div id="authority_search_ahead_results">
<% for result in @xapian_requests.results %>
- <%= render :partial => 'body_listing_single', :locals => { :public_body => result[:model] } %>
+ <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
<% end %>
</div>
<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %>
<% end %>
-</div>
diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb
index c01e2776f..75c51fc57 100644
--- a/app/views/request/select_authority.html.erb
+++ b/app/views/request/select_authority.html.erb
@@ -42,26 +42,9 @@
<%= submit_tag _('Search') %>
</div>
<% end %>
- <div id="typeahead_response">
- <% if !@xapian_requests.nil? %>
- <% if @xapian_requests.results.size > 0 %>
- <h3><%= _('Top search results:') %></h3>
- <p>
- <%= _('Select one to see more information about the authority.')%>
- </p>
- <% else %>
- <h3><%= _('No results found.') %></h3>
- <% end %>
- <div id="authority_search_ahead_results">
- <% for result in @xapian_requests.results %>
- <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
- <% end %>
- </div>
-
- <% end %>
-
-
+ <div id="typeahead_response">
+ <%= render :partial => 'public_body/search_ahead' %>
</div>
</div>