diff options
-rw-r--r-- | docs/_layouts/pro.html | 3 | ||||
-rw-r--r-- | docs/pro-manual/admin-tasks.md | 2 | ||||
-rw-r--r-- | docs/pro-manual/deep-linking.md | 92 | ||||
-rw-r--r-- | docs/pro-manual/staff-user-accounts.md | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 16 | ||||
-rw-r--r-- | t/cobrand/oxfordshire.t | 7 | ||||
-rw-r--r-- | templates/web/fixmystreet.com/before_wrapper.html | 26 | ||||
-rw-r--r-- | web/cobrands/fixmystreet.com/_survey-banner.scss | 124 | ||||
-rw-r--r-- | web/cobrands/fixmystreet.com/base.scss | 1 | ||||
-rw-r--r-- | web/cobrands/tfl/assets.js | 1 |
10 files changed, 115 insertions, 159 deletions
diff --git a/docs/_layouts/pro.html b/docs/_layouts/pro.html index d71a50812..d79163989 100644 --- a/docs/_layouts/pro.html +++ b/docs/_layouts/pro.html @@ -83,7 +83,8 @@ <nav class="sidebar"> <ul> <li><a href="/pro-manual/">What is FixMyStreet Pro?</a></li> - <li><a href="/pro-manual/citizens-experience/">The Citizens Experience</a></li> + <li><a href="/pro-manual/citizens-experience/">The Citizen’s Experience</a></li> + <li><a href="/pro-manual/deep-linking/">Deep linking from your site</a></li> <li><a href="/pro-manual/staff-user-accounts/">Staff User Accounts</a></li> <li><a href="/pro-manual/admin-tasks/">Administrator Tasks</a> <ul> diff --git a/docs/pro-manual/admin-tasks.md b/docs/pro-manual/admin-tasks.md index 933592d79..d4f48a5eb 100644 --- a/docs/pro-manual/admin-tasks.md +++ b/docs/pro-manual/admin-tasks.md @@ -1,7 +1,7 @@ --- layout: pro title: Administrator tasks -order: 4 +order: 5 user-guide: true --- diff --git a/docs/pro-manual/deep-linking.md b/docs/pro-manual/deep-linking.md new file mode 100644 index 000000000..dae9480e8 --- /dev/null +++ b/docs/pro-manual/deep-linking.md @@ -0,0 +1,92 @@ +--- +layout: pro +title: FixMyStreet Pro deep linking +order: 3 +user-guide: true +categories: user-guide +--- + +# FixMyStreet Pro deep linking + +Your user will most likely be starting their journey of reporting an issue on +your own website. That may be a generic report an issue page, but could be a +page on a particular type of issue, such as Graffiti or Potholes. + +## Generic reporting page + +On a generic page, you can link directly to the FixMyStreet Pro front page with +a normal link, or embed a FixMyStreet Pro search form into the page, taking the +user straight to a map page. + +### Direct link + +Your website will have its own way of adding links. + +`<a href="https://your.fixmystreet.example/">Report a problem</a>` + +### Embedded form + +An embedded form should be a normal HTML form +whose action is `https://your.fixmystreet.example/around` and contains a text +input with name `pc`. Ideally it would also have a hidden field called `js` +that is set to 1 if the user has JavaScript enabled (this can speed the response up). +If you want to get really fancy and add geolocation to your own site, you can +also link to an `/around` page with parameters `latitude` and `longitude`. + +```html +<form action="https://your.fixmystreet.example/around"> +<label for="pc">Search term:</label> +<input type="text" id="pc" name="pc" value=""> +<input type="submit" value="Go"> +</form> +``` + +## Specific category page + +On a category page, you can also do either of the above things, but also +include an extra parameter that will restrict the default map view and +reporting to a particular category, categories, or parent category if you use +subcategories. + +### Direct link + +To link to one category, add a `filter_category` parameter with the +category/subcategory you wish to pre-filter, or provide multiple categories +separated by a comma (if one of your categories contains a comma, surround it +with double quotes). If you use subcategories in your installation and wish to +restrict the map to a particular top-level category, not an individual +subcategory, you should use a `filter_group` parameter with the name of the +top-level category. + +* https://your.fixmystreet.example/?filter_category=Graffiti + +* https://your.fixmystreet.example/?filter_category="A,+B,+and+C" + +* https://your.fixmystreet.example/?filter_category=Graffiti,Flyposting + +* https://your.fixmystreet.example/?filter_group=Road+defects + +### Embedded form + +Within a web form, specify the `filter_category` or `filter_group` as a hidden +field for equivalent behaviour to the link. + +Using `filter_category` will restrict the map pins to that category, and +automatically use that category when a report is begun; if you use multiple +categories, the map is filtered but no category is selected when a report is +begun. Using `filter_group` will restrict the map pins to all subcategories in +that category, preselect that category when a report is begun and the user will +still need to pick the correct subcategory. + +```html +<form action="https://your.fixmystreet.example/around"> +<input type="hidden" name="filter_category" value="Graffiti"> +<label for="pc">Search term:</label> +<input type="text" id="pc" name="pc" value=""> +<input type="submit" value="Go"> +</form> +``` + +* `<input type="hidden" name="filter_group" value="Trees">` + +* `<input type="hidden" name="filter_category" value='Trees,"Cars, bikes, trains"'>` diff --git a/docs/pro-manual/staff-user-accounts.md b/docs/pro-manual/staff-user-accounts.md index 1ea927fe9..37997ada2 100644 --- a/docs/pro-manual/staff-user-accounts.md +++ b/docs/pro-manual/staff-user-accounts.md @@ -1,7 +1,7 @@ --- layout: pro title: FixMyStreet Pro staff user accounts -order: 3 +order: 4 user-guide: true categories: user-guide --- diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index b110731e6..8ce12a81b 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -206,13 +206,21 @@ sub dashboard_export_problems_add_columns { my $self = shift; my $c = $self->{c}; - push @{$c->stash->{csv}->{headers}}, "HIAMS Ref"; - push @{$c->stash->{csv}->{columns}}, "customer_reference"; + push @{$c->stash->{csv}->{headers}}, "HIAMS/Exor Ref"; + push @{$c->stash->{csv}->{columns}}, "external_ref"; $c->stash->{csv}->{extra_data} = sub { - my $ref = shift->get_extra_metadata('customer_reference') || ''; + my $report = shift; + # Try and get a HIAMS reference first of all + my $ref = $report->get_extra_metadata('customer_reference'); + unless ($ref) { + # No HIAMS ref which means it's either an older Exor report + # or a HIAMS report which hasn't had its reference set yet. + # We detect the latter case by the id and external_id being the same. + $ref = $report->external_id if $report->id ne ( $report->external_id || '' ); + } return { - customer_reference => $ref, + external_ref => ( $ref || '' ), }; }; } diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t index 907c66c19..1d59909b9 100644 --- a/t/cobrand/oxfordshire.t +++ b/t/cobrand/oxfordshire.t @@ -112,6 +112,9 @@ subtest 'extra CSV columns are present' => sub { MAPIT_URL => 'http://mapit.uk/', }, sub { + $problems[1]->update({ external_id => $problems[1]->id }); + $problems[2]->update({ external_id => "123098123" }); + $mech->log_in_ok( $counciluser->email ); $mech->get_ok('/dashboard?export=1'); @@ -126,11 +129,13 @@ subtest 'extra CSV columns are present' => sub { 'Created', 'Confirmed', 'Acknowledged', 'Fixed', 'Closed', 'Status', 'Latitude', 'Longitude', 'Query', 'Ward', 'Easting', 'Northing', 'Report URL', 'Site Used', - 'Reported As', 'HIAMS Ref', + 'Reported As', 'HIAMS/Exor Ref', ], 'Column headers look correct'; is $rows[1]->[20], 'ENQ12456', 'HIAMS reference included in row'; + is $rows[2]->[20], '', 'Report without HIAMS ref has empty ref field'; + is $rows[3]->[20], '123098123', 'Older Exor report has correct ref'; }; }; diff --git a/templates/web/fixmystreet.com/before_wrapper.html b/templates/web/fixmystreet.com/before_wrapper.html deleted file mode 100644 index 9fc07343b..000000000 --- a/templates/web/fixmystreet.com/before_wrapper.html +++ /dev/null @@ -1,26 +0,0 @@ -<div class="survey-banner"> - <p> - <span class="survey-banner__text">Share your views and help us improve FixMyStreet for everyone</span> - <a class="survey-banner__cta" href="https://www.surveygizmo.com/s3/5506345/46e9932d0fbf" target="_blank">Take our short survey</a> - </p> - <button class="survey-banner__close">Close</button> -</div> -<script nonce="[% csp_nonce %]"> -(function(){ - var live_site = location.hostname === 'www.fixmystreet.com'; - var hasnt_opted_out = document.cookie.indexOf('__has_closed_march_2020_survey') === -1; - var randomly_chosen = Math.random() > 0.6; - if ( live_site && hasnt_opted_out && randomly_chosen ) { - document.body.className = ((document.body.className) ? document.body.className + ' has-survey-banner' : 'has-survey-banner'); - document.querySelector('.survey-banner').style.display = 'block'; - } - function hide_survey(){ - document.querySelector('.survey-banner').style.display = 'none'; - document.body.className = document.body.className.replace('has-survey-banner', ''); - var t = new Date(); t.setFullYear(t.getFullYear() + 1); - document.cookie = '__has_closed_march_2020_survey=1; path=/; expires=' + t.toUTCString(); - } - document.querySelector('.survey-banner__close').onclick = hide_survey; - document.querySelector('.survey-banner__cta').onclick = hide_survey; -})(); -</script> diff --git a/web/cobrands/fixmystreet.com/_survey-banner.scss b/web/cobrands/fixmystreet.com/_survey-banner.scss deleted file mode 100644 index a3db76ba4..000000000 --- a/web/cobrands/fixmystreet.com/_survey-banner.scss +++ /dev/null @@ -1,124 +0,0 @@ -.survey-banner { - display: none; // will get shown by javascript - background: #A94CA6; - color: #fff; - position: relative; - z-index: 1; // stack in front of the page top border - text-align: center; - padding: 0 2.5em; // make space for the close button - - .map-reporting & { - display: none !important; - } - - p { - margin: 0; - padding: 12px 0; // 12px vertical padding, plus 4px margin on childen = 16px = 1em - line-height: 1.3; - } -} - -.survey-banner__text, -.survey-banner__cta { - display: inline-block; - margin: 4px 8px; -} - -.survey-banner__text { - font-size: 0.9em; -} - -.survey-banner__cta { - font-size: 0.8em; - font-weight: bold; - background: #fff; - color: #000; - padding: 0.4em 1em; - border-radius: 3em; - text-decoration: none; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); - - &:visited { - color: #000; - } - - &:focus { - outline: none; - box-shadow: 0 0 0 4px $primary; - } - - &:hover, - &:active { - background: mix(#A94CA6, #fff, 10%); - color: #000; - text-decoration: none; - } -} - -.survey-banner__close { - display: block; - position: absolute; - top: 0.5em; - right: 0.5em; - - width: 2em; - height: 0; - padding-top: 2em; - overflow: hidden; - - color: #fff; - background: transparent; - border: none; - - &:before { - display: block; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - content: "\00d7"; - font-size: 2em; - } - - @media screen and (min-width: 48em) { - top: 50%; - right: 0.75em; - transform: translate(0, -50%); - } -} - - -@media screen and (min-width: 48em) { - .mappage.has-survey-banner { - $mappage-header-height: 4em !default; - $banner-height: 3.5em; - - .survey-banner { - p { - display: flex; - justify-content: center; - align-items: center; - height: $banner-height; - padding-top: 0; - padding-bottom: 0; - } - } - - #site-header { - top: 0 + $banner-height; - } - - #map_box, - #map_sidebar { - top: $mappage-header-height + $banner-height; - } - - .nav-wrapper { - @if ($header-top-border) { - top: $header-top-border-width + $banner-height; - } @else { - top: 0 + $banner-height; - } - } - } -} diff --git a/web/cobrands/fixmystreet.com/base.scss b/web/cobrands/fixmystreet.com/base.scss index e17a7e4cf..f261e677d 100644 --- a/web/cobrands/fixmystreet.com/base.scss +++ b/web/cobrands/fixmystreet.com/base.scss @@ -176,7 +176,6 @@ svg|g.site-logo__svg { border-bottom: none; } -@import "survey-banner"; $mysoc-footer-background-color: #222; $mysoc-footer-text-color: #acacac; diff --git a/web/cobrands/tfl/assets.js b/web/cobrands/tfl/assets.js index 203df578f..ad58c5c8a 100644 --- a/web/cobrands/tfl/assets.js +++ b/web/cobrands/tfl/assets.js @@ -177,6 +177,7 @@ fixmystreet.assets.add(asset_defaults, { asset_id_field: 'STOP_CODE', attributes: { stop_code: 'STOP_CODE', + shelter_id: 'SHELTER_ID', }, asset_group: "Bus Stops and Shelters", asset_item: 'bus stop' |