aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-11-28 09:11:39 +0000
committerMatthew Somerville <matthew@mysociety.org>2017-11-28 11:23:43 +0000
commitdce9ff35c07a1da31180bf47c158d7bc03fb430a (patch)
treeccae8baa1f549aab1f506b01fa78a632e89b982b
parent068dc61ef58b7eab521c9a009f0554fdb98512ed (diff)
Fix back bug, from report after using list filters
The popstate event for a filter change assumed that the list was already being displayed, but it was not if you were going back from a report. The reports_list function to display the list page is idempotent (though this commit makes it more so), so can happily be called whether the list page is currently displayed or not.
-rw-r--r--CHANGELOG.md1
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js9
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24109c75b..221fa3ade 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@
- Prevent multiple 'Expand map' links appearing. #1909
- Superusers without a from_body can make reports again. #1913
- Fix crash when viewing /around in certain locales. #1916
+ - Fix back bug, from report after using list filters. #1920
- Admin improvements:
- Character length limit can be placed on report detailed information #1848
- Inspector panel shows nearest address if available #1850
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index a2d39d0dd..f73792a3c 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -1073,8 +1073,12 @@ fixmystreet.display = {
reports_list: function(reportListUrl, callback) {
// If the report list is already in the DOM,
// just reveal it, rather than loading new page.
- if ($('#side').length) {
- $('#side').show();
+ var side = document.getElementById('side');
+ if (side) {
+ if (side.style.display !== 'none') {
+ return;
+ }
+ side.style.display = '';
$('#side-form').hide();
// Report page may have been one or two columns, remove either
$('#side-report').remove();
@@ -1178,6 +1182,7 @@ $(function() {
$('#sort').val(e.state.filter_change.sort);
$('#filter_categories').add('#statuses')
.trigger('change.filters').trigger('change.multiselect');
+ fixmystreet.display.reports_list(location.href);
} else if ('hashchange' in e.state) {
// This popstate was just here because the hash changed.
// (eg: mobile nav click.) We want to ignore it.