diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-19 15:58:42 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-19 15:58:42 +0000 |
commit | b79674b0145fc2c4cb57ed77ceec39246d02621c (patch) | |
tree | 8427323960381e28038b354657f76b633aa82cb5 | |
parent | 20fa5ef4c92dc7cab092412149fdb27b9faab145 (diff) |
Allow unconfirmed as a visible state in Zurich, adjust front end list/item templates to suit.
-rw-r--r-- | perllib/FixMyStreet/App.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 27 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Nearby.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 2 | ||||
-rw-r--r-- | templates/web/zurich/report/_item.html | 30 | ||||
-rw-r--r-- | templates/web/zurich/report/_main.html | 24 |
6 files changed, 74 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index fda9d665c..fde1fb931 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -188,6 +188,10 @@ sub setup_request { mySociety::MaPit::configure( "http://$host/fakemapit/" ); } + if ($c->cobrand->moniker eq 'zurich') { + FixMyStreet::DB::Result::Problem->visible_states_add_unconfirmed(); + } + return $c; } diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 32bdcbb4f..6cfe45bc0 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -252,21 +252,22 @@ HASHREF. =cut +my $visible_states = { + 'confirmed' => 1, + 'planned' => 1, + 'investigating' => 1, + 'in progress' => 1, + 'fixed' => 1, + 'fixed - council' => 1, + 'fixed - user' => 1, + 'closed' => 1, +}; sub visible_states { - my $states = { - 'confirmed' => 1, - 'planned' => 1, - 'investigating' => 1, - 'in progress' => 1, - 'fixed' => 1, - 'fixed - council' => 1, - 'fixed - user' => 1, - 'closed' => 1, - }; - - return wantarray ? keys %{$states} : $states; + return wantarray ? keys %{$visible_states} : $visible_states; +} +sub visible_states_add_unconfirmed { + $visible_states->{unconfirmed} = 1; } - my $tz = DateTime::TimeZone->new( name => "local" ); diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm index 191223572..4039ec6e7 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm @@ -25,7 +25,7 @@ sub nearby { columns => [ 'problem.id', 'problem.title', 'problem.latitude', 'problem.longitude', 'distance', 'problem.state', - 'problem.confirmed', { 'problem.photo' => 'problem.photo is not null' }, + 'problem.created', 'problem.confirmed', { 'problem.photo' => 'problem.photo is not null' }, ], bind => [ $mid_lat, $mid_lon, $dist ], order_by => [ 'distance', { -desc => 'created' } ], diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index a0ce9e4a7..96a9e3e6d 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -135,7 +135,7 @@ sub around_map { my $attr = { order_by => { -desc => 'created' }, columns => [ - 'id', 'title', 'latitude', 'longitude', 'state', 'confirmed', + 'id', 'title', 'latitude', 'longitude', 'state', 'created', 'confirmed', { photo => 'photo is not null' }, ], }; diff --git a/templates/web/zurich/report/_item.html b/templates/web/zurich/report/_item.html new file mode 100644 index 000000000..7de8aca29 --- /dev/null +++ b/templates/web/zurich/report/_item.html @@ -0,0 +1,30 @@ +<li> +<a class="text" href="[% c.uri_for('/report', problem.id ) %]"> + [% IF problem.state != 'unconfirmed' AND problem.photo %] + <img class="img" height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt=""> + [% END %] + [% IF problem.state != 'unconfirmed' %] + <h4>[% problem.title | html %]</h4> + [% ELSE %] + <h4><em>[% loc('Awaiting moderation') %]</em></h4> + [% END %] + <small>[% IF problem.created_local %] + [%- prettify_epoch( problem.created_local.epoch, 1 ) %] + [%- ELSE %] + [%- prettify_epoch( problem.created, 1 ) %] + [%- END %] + [%- IF dist %], [% dist %]km[% END %] + [%- IF include_lastupdate AND problem.created != problem.lastupdate AND problem.whensent != problem.lastupdate %], last updated [% prettify_epoch( problem.lastupdate, 1 ) %] + [%- END %] + [% IF include_lastupdate %] + [% IF problem.bodies > 1 %] [% loc('(sent to both)') %] + [% ELSIF problem.bodies == 0 %] [% loc('(not sent to council)') %] + [% END %] + [% END %] + [% IF NOT no_fixed AND problem.is_fixed %] + [% loc('(fixed)') %] + [% ELSIF NOT no_fixed AND problem.is_closed %] + [% loc('(closed)') %] + [% END %]</small> +</a> +</li> diff --git a/templates/web/zurich/report/_main.html b/templates/web/zurich/report/_main.html new file mode 100644 index 000000000..395737474 --- /dev/null +++ b/templates/web/zurich/report/_main.html @@ -0,0 +1,24 @@ +<div class="problem-header cf"> + [% IF problem.state != 'unconfirmed' %] + <h1>[% problem.title | html %]</h1> + [% END %] + + <p><em> + [% SET date_time = prettify_epoch( problem.created_local.epoch ) %] + [% IF problem.category AND problem.category != loc('Other') %] + [% tprintf( loc('Reported in the %s category at %s'), problem.category, date_time ) %] + [% ELSE %] + [% tprintf( loc('Reported at %s'), date_time ) %] + [% END %] + + [%- IF !problem.used_map %]; <strong>[% loc('there is no pin shown as the user did not use the map') %]</strong>[% END %] + </em></p> + + [% IF problem.state != 'unconfirmed' %] + [% INCLUDE 'report/photo.html' object=problem %] + [% add_links( problem.detail ) | html_para %] + [% ELSE %] + [% loc('This report is awaiting moderation.') %] + [% END %] + +</div> |