Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/ORPD-58 - No results found #28

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions orp/orp_search/public_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def finalise_results(
context["results_total_count"] = paginator.count
context["results_page_total"] = paginator.num_pages
context["current_page"] = config.offset
context["start_index"] = paginated_documents.start_index()
context["end_index"] = paginated_documents.end_index()
return context

def search(self, config: SearchDocumentConfig):
Expand Down
81 changes: 56 additions & 25 deletions orp/orp_search/templates/orp.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load service_problem_tags %}
{% load url_replace_tags %}
{% block head_title %}{{service_name}}{% endblock %}
{% block head_title %}{% if is_paginated %}Page {{current_page}} - {% endif %}{{service_name}}{% endblock %}
{% block service_name %}{{service_name}}{% endblock %}
{% block body_content %}
<div class="govuk-!-padding-top-4"></div>
Expand Down Expand Up @@ -204,11 +204,10 @@ <h2 class="govuk-fieldset__heading">
<div class="orp-flex orp-flex--space-between">
<p class="govuk-body govuk-!-font-weight-bold govuk-!-margin-bottom-0">
{% if results %}
{{ results_total_count }} documents
{% else %}
{% if form.is_bound %}
No documents found
{% if is_paginated %}
{{ start_index }} to {{ end_index }} of
{% endif %}
{{ results_total_count }} documents
{% endif %}
</p>
<p class="govuk-body govuk-!-margin-bottom-0">
Expand All @@ -234,20 +233,24 @@ <h2 class="govuk-fieldset__heading">
</ul> -->

<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="orp-flex">
<label class="govuk-label govuk-!-margin-right-3 orp-!-no-text-wrap" for="sort">
Sort by
</label>
<select class="govuk-select" id="sort" name="sort">
<option value="date">Recently updated</option>
<option value="sort">Relevance</option>
</select>

{% if results %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="orp-flex">
<label class="govuk-label govuk-!-margin-right-3 orp-!-no-text-wrap" for="sort">
Sort by
</label>
<select class="govuk-select" id="sort" name="sort">
<option value="date">Recently updated</option>
<option value="sort">Relevance</option>
</select>
</div>
</div>
</div>
</div>
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
{% endif %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
{% if results %}
Expand Down Expand Up @@ -321,14 +324,42 @@ <h2 class="govuk-heading-m">
</nav>
{% endif %}
{% else %}
{% if form.is_bound %}
<p class="govuk-body-l govuk-!-font-weight-bold">
We didn't find any regulations for that search.
</p>
<p class="govuk-body-m">
Please try searching again using different search terms.
</p>
{% endif %}
{% if form.is_bound %}
<h2 class="govuk-heading-l">There are no matching results</h2>
<p class="govuk-body-m">
Improve your search results by:
</p>
<ul class="govuk-list govuk-list--bullet">
<li class="govuk-body-m">
removing filters
</li>
<li class="govuk-body-m">
double-checking your spelling
</li>
<li class="govuk-body-m">
using fewer keywords
</li>
<li class="govuk-body-m">
searching for something less specific
</li>
</ul>
<h3 class="govuk-heading-m">Related searches</h2>
<p class="govuk-body">
Try these related search terms.
</p>
<ul class="govuk-list">
<li class="govuk-body">
<a class="govuk-link" href="/?search=construction+site+safety">construction site safety</a>
</li>
<li class="govuk-body">
<a class="govuk-link" href="/?search=building+site+safety">building site safety</a>
</li>
<li class="govuk-body">
<a class="govuk-link" href="/?search=aggregate+use">aggregate use</a>
</li>

</ul>
{% endif %}
{% endif %}
</div>
</div>
Expand Down