diff options
author | Struan Donald <struan@exo.org.uk> | 2012-08-27 12:58:26 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-08-27 14:12:27 +0100 |
commit | 1aeb10621ead53f55740e332c00c94277107666b (patch) | |
tree | e09e32e2f93077adcbdd072065bd2d580d0b917d /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | 796115ab56b4e0f1facef451f1d54e745f02bb44 (diff) |
Display support count even if not logged in
use a button for adding support rather than a link
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 05c08100d..4127b6247 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -56,15 +56,22 @@ sub display : Path('') : Args(1) { $c->forward( 'format_problem_for_display' ); } -sub support : Path('support') : Args(1) { - my ( $self, $c, $id ) = @_; +sub support : Path('support') : Args(0) { + my ( $self, $c ) = @_; + + my $id = $c->req->param('id'); + + my $uri = + $id + ? $c->uri_for( '/report', $id ) + : $c->uri_for('/'); - if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { + if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { $c->forward( 'load_problem_or_display_error', [ $id ] ); $c->stash->{problem}->interest_count( $c->stash->{problem}->interest_count + 1 ); $c->stash->{problem}->update; } - $c->res->redirect( $c->uri_for( '', $id ) ); + $c->res->redirect( $uri ); } sub load_problem_or_display_error : Private { |