-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DWPF-784 Typeahead strong match & no results redirect (#509)
- Added logic around zero results tabs, so that when no results are present in the tab, redirect. - Added Logic & UI for autocompletion search functionality via search-form. --------- Co-authored-by: Ryan Williams <[email protected]>
- Loading branch information
1 parent
22d978e
commit 5786ed3
Showing
13 changed files
with
251 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/search/templates/search/partials/result/autocomplete_page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{% load webpack_static from webpack_loader %} | ||
{% load wagtailcore_tags %} | ||
|
||
{% if search_query %} | ||
<div style="display:none" | ||
hx-on:htmx:load="dataLayer.push({ 'event': 'autocomplete-search', 'autocomplete-search_query': '{{ search_query }}', 'autocomplete_page_count':{{ pages_count }},'autocomplete_people_count':{{ people_count }},'autocomplete_teams_count':{{ teams_count }}});"> | ||
</div> | ||
{% endif %} | ||
|
||
{% if people %} | ||
<div class="govuk-heading-s autocomplete-title"> | ||
<a class="govuk-divnk" | ||
href="{% url 'search:category' 'people' %}?query={{ search_query }}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result-heading', 'autocomplete-result_selected_url': '{% url 'search:category' 'people' %}?query={{ search_query }}', 'autocomplete_result_selected_type': 'person'})"> | ||
People results</a> | ||
</div> | ||
{% endif %} | ||
{% for person in people %} | ||
<div class= "autocomplete-choice"> | ||
<a class="govuk-divnk" | ||
href="{% url 'profile-view' person.slug %}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result', 'autocomplete-result_selected_url': '{% url 'profile-view' person.slug %}', 'autocomplete_result_selected_type': 'person'})"> | ||
<div class="people"> | ||
{% if person.photo %} | ||
<img src="{{ person.photo_small.url }}" | ||
alt="Profile image of {{ person.get_full_name }}" | ||
class="profile-image"> | ||
{% else %} | ||
<img src="{% webpack_static 'no-photo.png' %}" | ||
alt="No photo" | ||
class="profile-image"> | ||
{% endif %} | ||
<p class="govuk-body autocomplete-text">{{ person.first_name }} {{ person.last_name }}</p> | ||
</div> | ||
</a> | ||
</div> | ||
{% endfor %} | ||
{% if pages %} | ||
<div class="govuk-heading-s autocomplete-title"> | ||
<a class="govuk-divnk" | ||
href="{% url 'search:category' 'all' %}?query={{ search_query }}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result-heading', 'autocomplete-result_selected_url': '{% url 'search:category' 'all' %}?query={{ search_query }}', 'autocomplete_result_selected_type': 'page'})">Content results</a> | ||
</div> | ||
{% endif %} | ||
{% for page in pages %} | ||
<div class="autocomplete-choice"> | ||
<a class="govuk-divnk" | ||
href="{% pageurl page %}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result', 'autocomplete-result_selected_url': '{% pageurl page %}', 'autocomplete_result_selected_type': 'all'})"> | ||
<div> | ||
<p class="govuk-body autocomplete-text">{{ page.title }}</p> | ||
</div> | ||
</a> | ||
</div> | ||
{% endfor %} | ||
{% if teams %} | ||
<div class="govuk-heading-s autocomplete-title"> | ||
<a class="govuk-divnk" | ||
href="{% url 'search:category' 'teams' %}?query={{ search_query }}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result-heading', 'autocomplete-result_selected_url': '{% url 'search:category' 'teams' %}?query={{ search_query }}', 'autocomplete_result_selected_type': 'teams'})">Teams results</a> | ||
</div> | ||
{% endif %} | ||
{% for team in teams %} | ||
<div class="autocomplete-choice"> | ||
<a class="govuk-divnk" | ||
href="{% url 'team-view' team.slug %}" | ||
onclick="dataLayer.push({ 'event': 'autocomplete-result', 'autocomplete-result_selected_url': '{% url 'team-view' team.slug %}', 'autocomplete_result_selected_type': 'teams'})"> | ||
<div> | ||
<p class="govuk-body autocomplete-text">{{ team.name }}</p> | ||
</div> | ||
</a> | ||
</div> | ||
{% endfor %} |
2 changes: 1 addition & 1 deletion
2
src/search/templates/search/partials/search_category_single_tab.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.