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

"Search tips" message when there are no location search results #3180

Merged
merged 2 commits into from
Sep 28, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- Rewrite open311-update-reports to share code and improve functionality.
- UK:
- Add option for recaptcha. #3050
- Display search tips when location search returns no results. #3180

* v3.0.1 (6th May 2020)
- New features:
Expand Down
3 changes: 2 additions & 1 deletion perllib/FixMyStreet/TestMech.pm
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,13 @@ arrayref of TEXTs. If none found return empty arrayref.
sub page_errors {
my $mech = shift;
my $result = scraper {
process 'div.form-error, p.form-error, p.error, ul.error li', 'errors[]', 'TEXT';
process 'div.form-error, p.form-error, p.error, ul.error li, .search-help__header', 'errors[]', 'TEXT';
}
->scrape( $mech->response );
my $err = $result->{errors} || [];
my %seen = ();
$err = [ grep { not $seen{$_}++ } @$err ];
@$err = map { s/^\s+|\s+$//g; $_ } @$err;
return $err;
}

Expand Down
2 changes: 1 addition & 1 deletion templates/web/base/around/postcode_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
%]
<a href="[% c.uri_for('/around', link_params) | html %]" id="geolocate_link">&hellip; [% loc('or use my location') %]</a>

[% UNLESS possible_location_matches %]
[% UNLESS possible_location_matches OR location_error_pc_lookup %]
[% INCLUDE 'around/_postcode_form_post.html' %]
[% END %]
</div>
Expand Down
31 changes: 31 additions & 0 deletions templates/web/fixmystreet.com/around/location_error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[% IF location_error_pc_lookup %]

<div class="search-help">
<h2 class="search-help__header" role="alert">
[% location_error | safe %]
</h2>

<div class="search-help__tips">
<div class="search-help__tips__category">
<h3>[% loc('Searching by postcode?') %]</h3>
<ul>
<li>[% loc('Check you <strong>haven’t swapped numbers and letters</strong>. <code>O</code>, <code>0</code>, <code>I</code> and <code>1</code> aren’t the same.') %]</li>
<li>[% loc('<strong>Don’t forget the space</strong> in your postcode.') %]</li>
<li>[% loc('<strong>Don’t mix postcodes and street names.</strong>') %]</li>
</ul>
</div>
<div class="search-help__tips__category">
<h3>[% loc('Searching by street name?') %]</h3>
<ul>
<li>[% loc('<strong>One at a time!</strong> Multiple street names in a single search can confuse us.') %]</li>
<li>[% loc('If you’re <strong>not sure on the spelling</strong>, try another nearby street you <em>are</em> sure about, then trace your way back on our map.') %]</li>
</ul>
</div>
</div>
</div>

[% ELSE %]

<p class="form-error">[% location_error | safe %]</p>

[% END %]
3 changes: 3 additions & 0 deletions web/cobrands/bathnes/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ $front_main_background: $bathnes-primary;

$menu-image: 'menu-black';
$header-top-border: false;

$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
2 changes: 2 additions & 0 deletions web/cobrands/bexley/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ $header-top-border: false;
$heading-font: Lato, sans-serif;
$body-font: Lato, sans-serif;
$meta-font: $body-font;

$search-help-background: #fff3f3;
4 changes: 4 additions & 0 deletions web/cobrands/borsetshire/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ $mappage-header-height: 5em; // 3em #site-logo plus 1em padding top and bottom
$body-font: Cabin, "Calibri", "Gill Sans", "Gill Sans MT", sans-serif;
$meta-font: $body-font;
$heading-font: $body-font;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
6 changes: 6 additions & 0 deletions web/cobrands/bristol/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ $header-top-border: false;

$col_click_map: $g1;
$col_click_map_dark: darken($g1, 10%);

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-weight: normal;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin-desktop: -1em -1em 0 -1em;
4 changes: 4 additions & 0 deletions web/cobrands/bristol/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ label {
color: $g7 !important;
font-weight: bold !important;
}

b, strong {
@extend %bold-font;
}
2 changes: 2 additions & 0 deletions web/cobrands/bromley/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ $header-top-border-width: 4px;

// Override the container width to match Bromley' site, which is wider
$container-max-width: 1200px;

$search-help-header-font-size-desktop: 1.25em;
4 changes: 4 additions & 0 deletions web/cobrands/buckinghamshire/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ $col_click_map_dark: darken($bucks_charcoal, 10%);
$header-top-border-width: 0;
$header-top-border: 0;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;

@mixin bucks-button {
background-color: $bucks_button_bg;
border: 0;
Expand Down
5 changes: 5 additions & 0 deletions web/cobrands/cheshireeast/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ $header-top-border: false;
$heading-font: 'Open Sans', sans-serif;
$body-font: 'Open Sans', sans-serif;
$meta-font: $body-font;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin-desktop: 0;
4 changes: 4 additions & 0 deletions web/cobrands/cheshireeast/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ a#geolocate_link {
}
}

.search-help__header {
line-height: 1.3;
}

/* Header/footer */

#site-logo {
Expand Down
5 changes: 5 additions & 0 deletions web/cobrands/eastherts/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ $container-max-width: 70.5em; // match 1128px row width in East Herts template
$eh-header-height: 84px + 16px + 16px;
$eh-nav-height: 48px;
$mappage-header-height: $eh-header-height + $eh-nav-height;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin-desktop: 0;
1 change: 0 additions & 1 deletion web/cobrands/fixmystreet.com/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ svg|g.site-logo__svg {
border-bottom: none;
}


$mysoc-footer-background-color: #222;
$mysoc-footer-text-color: #acacac;
$mysoc-footer-site-name-text-color: #fff;
Expand Down
4 changes: 4 additions & 0 deletions web/cobrands/fixmystreet.com/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ a#geolocate_link {
}
}

.search-help__header {
font-family: inherit;
}

body.frontpage {
#site-logo {
margin: 2em 0;
Expand Down
4 changes: 4 additions & 0 deletions web/cobrands/greenwich/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ $col_big_numbers: $primary;
$col_click_map: $greenwich_red;

$container-max-width: 990px;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
8 changes: 7 additions & 1 deletion web/cobrands/hackney/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ $montserrat: 'Montserrat', Arial, sans-serif;

$heading-font: $montserrat;
$body-font: $montserrat;
$meta-font: $montserrat;
$meta-font: $montserrat;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin: 0 -1em;
$search-help-margin-desktop: 0 -1em;
3 changes: 3 additions & 0 deletions web/cobrands/hart/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ $mappage-header-height: 173px + 32px;
$header-top-border: false;

$container-max-width: 60em;

$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
6 changes: 6 additions & 0 deletions web/cobrands/highwaysengland/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ $mappage-header-height: 5.75em;
$body-font: "proxima-nova", "Proxima Nova", Montserrat, Arial, sans-serif;
$heading-font: $body-font;
$meta-font: $body-font;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin: 0 -1em;
$search-help-margin-desktop: 0 -1em;
4 changes: 4 additions & 0 deletions web/cobrands/hounslow/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ $header-top-border: false;
$heading-font: InfoText, Frutiger, Arial, sans-serif;
$body-font: Frutiger, Arial, sans-serif;
$meta-font: $body-font;

$search-help-background: #fff3f3;
$search-help-header-background: $red;
$search-help-header-font-size-desktop: 1.25em;
3 changes: 3 additions & 0 deletions web/cobrands/isleofwight/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ $header-top-border: false;
$body-font: Helvetica, Arial, sans-serif;
$heading-font: $body-font;
$meta-font: $body-font;

$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
6 changes: 6 additions & 0 deletions web/cobrands/lincolnshire/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ $menu-image: 'menu-black';

$front_main_background: white;
// $header-top-border: false;

$search-help-alignment: left;
$search-help-header-color: $lincs-pop;
$search-help-header-background: transparent;
$search-help-header-font-size-desktop: 1.25em;
$search-help-margin-desktop: -2em -2em 0 -2em;
4 changes: 4 additions & 0 deletions web/cobrands/northamptonshire/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ $header-top-border: false;
$heading-font: PraterSansWeb, sans-serif;
$body-font: "Open Sans", Arial, "Helvetica Neue", Helvetica, sans-serif;
$meta-font: $body-font;

$search-help-background: #fff3f3;
$search-help-header-font-size-desktop: 1.25em;
$search-help-header-font-family: inherit;
4 changes: 4 additions & 0 deletions web/cobrands/oxfordshire/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ $header-top-border: false;
$form-control-border-color: #525252;

$pin_prefix: '/cobrands/oxfordshire/images/';

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-margin-desktop: -2em 0 0 0;
7 changes: 7 additions & 0 deletions web/cobrands/oxfordshire/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ ol.big-numbers {
margin-bottom: 1em;
padding-bottom: 5px;
}

// Overloaded selector, to override `.content h2`
h2.search-help__header {
margin-bottom: 0;
padding-bottom: 1rem;
font-size: 1em;
}
}

dd, p {
Expand Down
5 changes: 5 additions & 0 deletions web/cobrands/oxfordshire/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ $mappage-header-height: 10em;
.content h2 {
font-size: 2em;
}

// Overloaded selector, to override `.content h2`
h2.search-help__header {
font-size: 20px;
}
}

#front_stats {
Expand Down
6 changes: 6 additions & 0 deletions web/cobrands/peterborough/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ $roboto: 'Roboto', Arial, sans-serif;
$heading-font: $roboto;
$body-font: $roboto;
$meta-font: $roboto;

$search-help-alignment: left;
$search-help-background: #fff3f3;
$search-help-margin: 1em -1em 0 -1em;
$search-help-margin-desktop: -2em -1em 0 -1em;
$search-help-header-font-size-desktop: 1.25em;
1 change: 1 addition & 0 deletions web/cobrands/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2829,3 +2829,4 @@ $nicetable-hover-background: rgba($primary, 0.15) !default;
@import "_autocomplete";
@import "_dashboard";
@import "_top-banner";
@import "_search-help";
78 changes: 78 additions & 0 deletions web/cobrands/sass/_search-help.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
$search-help-alignment: center !default;
$search-help-background: transparent !default;
$search-help-color: inherit !default;
$search-help-margin: -1em -1em 0 -1em !default; // overlap .container padding
$search-help-margin-desktop: -1em -1em -2em -1em !default; // overlap .content and .tablewrapper padding-bottoms
$search-help-header-background: #DB3914 !default;
$search-help-header-color: #fff !default;
$search-help-header-font-weight: bold !default;
$search-help-header-font-size: 1em !default;
$search-help-header-font-size-desktop: $search-help-header-font-size !default;
$search-help-header-font-family: null !default;

.search-help {
margin: $search-help-margin;
background: $search-help-background;
color: $search-help-color;

// Override greedy `.tablewrapper > div` styles
.tablewrapper > & {
display: block;
width: auto;
}

@media (min-width: 48em) {
margin: $search-help-margin-desktop;
}
}

.search-help__header {
margin: 0;
text-align: $search-help-alignment;
background: $search-help-header-background;
color: $search-help-header-color;
font-family: $search-help-header-font-family;
font-weight: $search-help-header-font-weight;
font-size: $search-help-header-font-size;
padding: 1em; // IE8
padding: 1rem;

@media (min-width: 48em) {
font-size: $search-help-header-font-size-desktop;
}
}

.search-help__tips {
overflow: auto; // expand to include margin-bottom on last child

@media (min-width: 48em) {
@include flex-container();
@if ( $search-help-alignment == left ) {
@include justify-content(flex-start);
} @else if ( $search-help-alignment == right ) {
@include justify-content(flex-end);
} @else {
@include justify-content(center);
padding: 1em 0;
}
}

h3 {
margin-top: 0;
text-align: $search-help-alignment;
}
}

.search-help__tips__category {
margin: 1em;

@media (min-width: 48em) {
max-width: 20em;
}

ul {
margin-bottom: 0;
font-size: 0.875em;
margin-left: 1em;
}
}
3 changes: 3 additions & 0 deletions web/cobrands/stevenage/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ $nav_hover_background_colour: #444;
$col_click_map: #00BD08;

$container-max-width: 984px; // to match Stevenage header width

$search-help-background: #fff3f3;
$search-help-margin-desktop: -2em -2em 0 -2em;
5 changes: 5 additions & 0 deletions web/cobrands/tfl/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ $col_fixed_label_dark: #4B8304;

$header-top-border: false;

$search-help-alignment: left;
$search-help-background: $red-light;
$search-help-header-background: $red;
$search-help-margin-desktop: -1em -1em 0em -1em;

@mixin tflbutton {
background: $beck-blue;
border-radius: 22.5px;
Expand Down