aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-11-07 15:18:11 +0000
committerLouise Crow <louise.crow@gmail.com>2013-11-07 15:19:06 +0000
commit6524c746c31a7e6243249bcbe88c1a58f2088208 (patch)
treee6f61b63d11ef39e957a441f2d59461d98390dc3
parentb80dbedbf388b0f7cb3b3a44c96e292242e6fdf3 (diff)
Show 'browse all' and 'ask us to add' one for authority only search.
This is for the case where there are no results and the user was explicitly searching for authorities.
-rw-r--r--app/views/general/search.html.erb2
-rw-r--r--spec/controllers/general_controller_spec.rb5
2 files changed, 7 insertions, 0 deletions
diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb
index 59b4cc5d5..18f258444 100644
--- a/app/views/general/search.html.erb
+++ b/app/views/general/search.html.erb
@@ -158,6 +158,8 @@
</div>
<%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %>
+ <% elsif @variety_postfix == 'bodies' %>
+ <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p>
<% end %>
</div>
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index ecd403315..593d51683 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -249,6 +249,11 @@ describe GeneralController, 'when using xapian search' do
assigns[:xapian_bodies].results.map{|x|x[:model]}.should == [public_bodies(:geraldine_public_body)]
end
+ it 'should show "Browse all" link if there are no results for a search restricted to bodies' do
+ get :search, :combined => "noresultsshouldbefound/bodies"
+ response.body.should include('Browse all')
+ end
+
it "should show help when searching for nothing" do
get :search_redirect, :query => nil
response.should render_template('search')