-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Location search now handles all area types
Fixes #504. AreaSearchView no longer artificially limits results to WMC area_types, and area_search.html presents matching areas grouped by area_type. I’ve gone with a custom `grid` layout on the area_search.html (rather than Bootstrap columns) to more gracefully handle a variable number of columns – there might be 1, 2, or 3, depending on the search input. I also fixed a bug in the `highlight` filter, which raised a TypeError when passed a None `search` parameter. `search` is None when the user has used geolocation rather than submitting a search term.
- Loading branch information
Showing
6 changed files
with
136 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.search-results { | ||
h2 { | ||
margin-top: 3rem; | ||
} | ||
|
||
@include media-breakpoint-up(lg) { | ||
display: grid; | ||
grid-auto-flow: column; | ||
grid-template-rows: repeat(3, auto); | ||
grid-auto-columns: minmax(auto, 30rem); // constrain col width when less than three in grid | ||
grid-column-gap: 2rem; | ||
} | ||
|
||
@include media-breakpoint-up(xl) { | ||
grid-column-gap: 3rem; | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
hub/templates/hub/includes/search-results-area-type-intro.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,25 @@ | ||
{% if type == "current-constituencies" %} | ||
{% if areas|length == 1 %} | ||
<h2 class="h4 text-primary">Current constituency</h2> | ||
<p class="text-muted">This is the constituency currently represented by an MP in UK Parliament.</p> | ||
{% else %} | ||
<h2 class="h4 text-primary">Current constituencies</h2> | ||
<p class="text-muted">These constituencies are the areas which MPs currently represent in UK Parliament.</p> | ||
{% endif %} | ||
{% elif type == "future-constituencies" %} | ||
{% if areas|length == 1 %} | ||
<h2 class="h4 text-primary">Future constituency</h2> | ||
<p class="text-muted">This is the constituency in which parliamentary candidates will soon be standing for election.</p> | ||
{% else %} | ||
<h2 class="h4 text-primary">Future constituencies</h2> | ||
<p class="text-muted">These are the constituencies in which parliamentary candidates will soon be standing for election.</p> | ||
{% endif %} | ||
{% elif type == "local-authorities" %} | ||
{% if areas|length == 1 %} | ||
<h2 class="h4 text-primary">Local authority</h2> | ||
<p class="text-muted">The local authority has powers over local services like education, planning, and transport.</p> | ||
{% else %} | ||
<h2 class="h4 text-primary">Local authorities</h2> | ||
<p class="text-muted">These bodies have powers over local services like education, planning, and transport.</p> | ||
{% endif %} | ||
{% endif %} |
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