Skip to content

Commit

Permalink
Merge pull request #202 from DFE-Digital/show-results-count
Browse files Browse the repository at this point in the history
Show results and handle empty result
  • Loading branch information
slawosz authored Aug 23, 2024
2 parents 6171aa6 + 83e7996 commit 94a426b
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/lib/local_authority/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def initialize(scope, query)
end

def call
return [] if geo_result.nil?

result = @scope.order_by_distance_from(search_centre)

if search_polygon
Expand Down
14 changes: 14 additions & 0 deletions app/views/search/results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body-l">
<b><%= pluralize(@search.hubs.count, 'result') %> found</b>
</p>
<% if @search.hubs.count.zero? %>
<p class="govuk-body">
Check that the location you have entered is in England and:
<ul class="govuk-list govuk-list--bullet">
<li>a valid first part of a postcode</li>
<li>or, a town or city</li>
</ul>
</p>
<% end %>
</div>
<div class="govuk-grid-column-two-thirds">
<p>
<%= link_to 'Change location', { action: :form } %>
Expand Down
308 changes: 305 additions & 3 deletions spec/fixtures/vcr_cassettes/geocoder.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 94a426b

Please sign in to comment.