aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm15
-rw-r--r--templates/web/fixmybarangay/report/_support.html11
-rw-r--r--templates/web/fixmystreet/report/_main.html1
-rw-r--r--templates/web/fixmystreet/report/display.html6
4 files changed, 23 insertions, 10 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 {
diff --git a/templates/web/fixmybarangay/report/_support.html b/templates/web/fixmybarangay/report/_support.html
new file mode 100644
index 000000000..e8b958940
--- /dev/null
+++ b/templates/web/fixmybarangay/report/_support.html
@@ -0,0 +1,11 @@
+[% IF c.cobrand.can_support_problems %]
+<p id="supporter"><small>
+ [% IF !problem.interest_count %][% text=loc('No supporters') %][% ELSIF problem.interest_count == 1 %][% text = loc('1 supporter') %][% ELSE %][% text = tprintf( loc('%d supporters' ), problem.interest_count ) %][% END %]
+ [% IF c.user && c.user.from_council %]<form action="[% c.uri_for( '/report/support' ) %]">
+ [% text %] <input type="hidden" name="id" value="[% problem.id %]"><input type="submit" class="green-btn" value="Add support">
+ </form>
+ [% ELSE %]
+ [% text %]
+ [% END %]
+</small></p>
+[% END %]
diff --git a/templates/web/fixmystreet/report/_main.html b/templates/web/fixmystreet/report/_main.html
index 7ceb1f6a5..debd9be73 100644
--- a/templates/web/fixmystreet/report/_main.html
+++ b/templates/web/fixmystreet/report/_main.html
@@ -13,6 +13,7 @@
<br><small>[% loc('Not reported to council') %]</small>
[% END %]
</em></p>
+[% TRY %][% INCLUDE 'report/_support.html' %][% CATCH file %][% END %]
[% INCLUDE 'report/photo.html' object=problem center=1 %]
diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html
index a97d9bcf5..ab4ee52df 100644
--- a/templates/web/fixmystreet/report/display.html
+++ b/templates/web/fixmystreet/report/display.html
@@ -18,12 +18,6 @@
[% INCLUDE 'report/banner.html' %]
-[% IF c.cobrand.can_support_problems && c.user && c.user.from_council %]
-<p style="float: right">
-<a href="[% c.uri_for( '/report/support', problem.id ) %]">Support</a> ( [% IF !problem.interest_count %]No supporters[% ELSIF problem.interest_count == 1 %]1 supporter[% ELSE %][% problem.interest_count %] supporters[% END %] )
-</p>
-[% END %]
-
[% INCLUDE 'report/_main.html' %]
[% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %]