aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-06-08 12:31:46 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-07-06 12:52:37 +0100
commit49782c333a340a667009eed261d0ef0ceb419f88 (patch)
treeced110d72f6e8684e6287c8e14e9c54c0b70680c
parent525c7f29761a158748cd068e3432115cd25b9f4c (diff)
Redirect correctly if filter used sans JavaScript.
It was being treated as a new report and showing errors, rather than showing you the same page with updated filters. Fixes #1422.
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm7
-rw-r--r--templates/web/base/reports/_list-filters.html2
2 files changed, 6 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 76098c119..696234d32 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -83,8 +83,9 @@ sub report_new : Path : Args(0) {
$c->forward('initialize_report');
# work out the location for this report and do some checks
+ # Also show map if we're just updating the filters
return $c->forward('redirect_to_around')
- unless $c->forward('determine_location');
+ if $c->get_param('filter_update') || !$c->forward('determine_location');
# create a problem from the submitted details
$c->stash->{template} = "report/new/fill_in_details.html";
@@ -1229,10 +1230,12 @@ sub redirect_to_around : Private {
my ( $self, $c ) = @_;
my $params = {
- pc => ( $c->stash->{pc} || $c->get_param('pc') || '' ),
lat => $c->stash->{latitude},
lon => $c->stash->{longitude},
};
+ foreach (qw(pc zoom status filter_category)) {
+ $params->{$_} = $c->get_param($_);
+ }
# delete empty values
for ( keys %$params ) {
diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html
index 4dd270dc6..d6f091aaa 100644
--- a/templates/web/base/reports/_list-filters.html
+++ b/templates/web/base/reports/_list-filters.html
@@ -25,7 +25,7 @@
<p class="report-list-filters">
[% tprintf(loc('<label>Show %s</label> <label>about %s</label>', 'The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories'), select_status, select_category) %]
- <input type="submit" value="[% loc('Go') %]">
+ <input type="submit" name="filter_update" value="[% loc('Go') %]">
</p>
[% IF use_section_wrapper %]