aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-01-28 10:42:49 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-01-28 10:42:49 +0000
commit6b5e472f6d7d50e88ff4161a71a82af21951e473 (patch)
treee42d305d6330372b48878c2ef705accf9d07c578
parent4f4720c7bc4d0e039b21e7eed848eaf431521ed1 (diff)
List all reports immediately on /reports for Zurich.
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm20
-rwxr-xr-xtemplates/web/zurich/reports/index.html30
2 files changed, 48 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 477d2dc0f..fc7eb522f 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -31,6 +31,22 @@ Show the summary page of all reports.
sub index : Path : Args(0) {
my ( $self, $c ) = @_;
+ # Zurich goes straight to map page, with all reports
+ if ( $c->cobrand->moniker eq 'zurich' ) {
+ $c->forward( 'load_and_group_problems' );
+ my $pins = $c->stash->{pins};
+ $c->stash->{page} = 'reports';
+ FixMyStreet::Map::display_map(
+ $c,
+ latitude => @$pins ? $pins->[0]{latitude} : 0,
+ longitude => @$pins ? $pins->[0]{longitude} : 0,
+ area => 274456,
+ pins => $pins,
+ any_zoom => 1,
+ );
+ return 1;
+ }
+
# Fetch all areas of the types we're interested in
my @bodies = $c->model('DB::Body')->all;
@bodies = sort { strcoll($a->name, $b->name) } @bodies;
@@ -381,7 +397,7 @@ sub load_and_group_problems : Private {
my ( %problems, @pins );
while ( my $problem = $problems->next ) {
$c->log->debug( $problem->cobrand . ', cobrand is ' . $c->cobrand->moniker );
- if ( !$c->stash->{body}->id ) {
+ if ( !$c->stash->{body} || !$c->stash->{body}->id ) {
# An external_body entry
add_row( $c, $problem, 0, \%problems, \@pins );
next;
@@ -435,7 +451,7 @@ sub add_row {
longitude => $problem->longitude,
colour => $c->cobrand->pin_colour( $problem, 'reports' ),
id => $problem->id,
- title => $problem->title,
+ title => $problem->title_safe,
};
}
diff --git a/templates/web/zurich/reports/index.html b/templates/web/zurich/reports/index.html
new file mode 100755
index 000000000..0ece1ca2c
--- /dev/null
+++ b/templates/web/zurich/reports/index.html
@@ -0,0 +1,30 @@
+[%
+ PROCESS "maps/${map.type}.html";
+ INCLUDE 'header.html',
+ title = loc('Summary reports'),
+ bodyclass = 'mappage';
+%]
+[% map_html %]
+</div>
+
+<div id="side">
+
+<h1>[% loc('All Reports') %]</h1>
+
+[% INCLUDE 'pagination.html', param = 'p' %]
+
+<section class="full-width">
+ [% IF problems.0 %]
+ <ul class="issue-list-a">
+ [% FOREACH problem IN problems.0 %]
+ [% INCLUDE 'reports/_list-entry.html' %]
+ [% END %]
+ </ul>
+ [% END %]
+</section>
+
+[% INCLUDE 'pagination.html', param = 'p' %]
+
+</div>
+[% INCLUDE 'footer.html' %]
+