diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 10 |
2 files changed, 19 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index ab5e62233..7809b5f12 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -346,13 +346,21 @@ sub send_email { $uri = $c->uri_with( ... ); -Simply forwards on to $c->req->uri_with - this is a common typo I make! +Forwards on to $c->req->uri_with, but also deletes keys that have a "" value +(as undefined is passed as that from a template). =cut sub uri_with { my $c = shift; - return $c->req->uri_with(@_); + my $uri = $c->req->uri_with(@_); + my $args = $_[0]; + my %params = %{$uri->query_form_hash}; + foreach my $key (keys %$args) { + delete $params{$key} if $args->{$key} eq ""; + } + $uri->query_form(\%params); + return $uri; } =head2 uri_for diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 79e11af9c..f05096525 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -521,7 +521,15 @@ sub ajax : Private { my $list_html = $c->render_fragment($template); - my $json = { pins => \@pins }; + my $pagination = $c->render_fragment('pagination.html', { + pager => $c->stash->{problems_pager} || $c->stash->{pager}, + param => 'p', + }); + + my $json = { + pins => \@pins, + pagination => $pagination, + }; $json->{reports_list} = $list_html if $list_html; my $body = encode_json($json); $c->res->body($body); |