aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/schema.sql5
-rw-r--r--db/schema_0022-add_interest_count_to_problems.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm11
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyBarangay.pm4
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm6
-rw-r--r--templates/web/fixmystreet/report/display.html8
7 files changed, 39 insertions, 3 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 690b7080f..571c71bcd 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -202,7 +202,10 @@ create table problem (
-- record details about messages from external sources, eg. message manager
external_source text,
- external_source_id text
+ external_source_id text,
+
+ -- number of me toos
+ interest_count integer
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
diff --git a/db/schema_0022-add_interest_count_to_problems.sql b/db/schema_0022-add_interest_count_to_problems.sql
new file mode 100644
index 000000000..62092aa0a
--- /dev/null
+++ b/db/schema_0022-add_interest_count_to_problems.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER table problem
+ ADD COLUMN interest_count integer;
+
+commit;
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index d36ba32fe..05c08100d 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -56,6 +56,17 @@ sub display : Path('') : Args(1) {
$c->forward( 'format_problem_for_display' );
}
+sub support : Path('support') : Args(1) {
+ my ( $self, $c, $id ) = @_;
+
+ if ( $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 ) );
+}
+
sub load_problem_or_display_error : Private {
my ( $self, $c, $id ) = @_;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 0eff95d48..b89eda0c1 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -693,5 +693,7 @@ Used in some cobrands to improve the intial display for Internet Explorer.
sub tweak_all_reports_map {}
+sub can_support_problems { return 0; }
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
index 3961e4dc1..355f1953f 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
@@ -53,5 +53,9 @@ sub areas_on_around {
return [ 1, 2 ];
}
+sub can_support_problems {
+ return 1;
+}
+
1;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index c55ed3403..af62a299b 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -95,6 +95,8 @@ __PACKAGE__->add_columns(
"external_source",
{ data_type => "text", is_nullable => 1 },
"external_source_id",
+ { data_type => "text", is_nullable => 1 },
+ "interest_count",
{ data_type => "integer", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
@@ -118,8 +120,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-07-12 11:05:48
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sOVQRjsQJUtpzElZvuCp8Q
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-08-23 12:14:00
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:05LIWlb0CUWAR7bN5RAhOA
# Add fake relationship to stored procedure table
__PACKAGE__->has_one(
diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html
index 8d0ada1a4..269b1d15e 100644
--- a/templates/web/fixmystreet/report/display.html
+++ b/templates/web/fixmystreet/report/display.html
@@ -17,8 +17,16 @@
</div>
[% 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> ( [% problem.interest_count %] supports )
+</p>
+[% END %]
+
[% INCLUDE 'report/_main.html' %]
+
<div class="shadow-wrap">
<ul id="key-tools">
<li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% loc('Report abuse' ) %]</a></li>