diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 10 | ||||
-rwxr-xr-x | templates/web/default/reports/council.html | 120 | ||||
-rwxr-xr-x | templates/web/default/reports/index.html | 44 | ||||
-rw-r--r-- | templates/web/fixmystreet/reports/cobrand_stats.html | 0 | ||||
-rwxr-xr-x | templates/web/fixmystreet/reports/council.html | 131 | ||||
-rwxr-xr-x | templates/web/fixmystreet/reports/index.html | 37 | ||||
-rwxr-xr-x | templates/web/fixmystreet/reports/ward.html | 1 |
7 files changed, 104 insertions, 239 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index e7620f755..dd6ecd9e3 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -341,9 +341,10 @@ sub load_and_group_problems : Private { { columns => [ 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', - { duration => { extract => "epoch from current_timestamp-lastupdate" } }, - { age => { extract => "epoch from current_timestamp-confirmed" } }, - { confirmed => { extract => 'epoch from confirmed' } }, + #{ duration => { extract => "epoch from current_timestamp-lastupdate" } }, + #{ age => { extract => "epoch from current_timestamp-confirmed" } }, + { confirmed => { extract => 'epoch from confirmed' } }, + { lastupdate => { extract => 'epoch from lastupdate' } }, { photo => 'photo is not null' }, ], order_by => { -desc => 'lastupdate' }, @@ -355,9 +356,10 @@ sub load_and_group_problems : Private { my ( %problems, @pins ); my $re_councils = join('|', keys %{$c->stash->{areas_info}}); - my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'duration', 'age', 'confirmed', 'photo' ); + my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'confirmed', 'lastupdate', 'photo' ); while ( my @problem = $problems->next ) { my %problem = zip @cols, @problem; + $problem{is_fixed} = FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; $c->log->debug( $problem{'cobrand'} . ', cobrand is ' . $c->cobrand->moniker ); if ( !$problem{council} ) { # Problem was not sent to any council, add to possible councils diff --git a/templates/web/default/reports/council.html b/templates/web/default/reports/council.html index ec9efbdbf..f4aa02e97 100755 --- a/templates/web/default/reports/council.html +++ b/templates/web/default/reports/council.html @@ -13,12 +13,13 @@ INCLUDE 'header.html', title = tprintf(loc('%s - Summary reports'), name) context = 'reports' + bodyclass = 'mappage' rss = [ tprintf(loc('Problems within %s, FixMyStreet'), name), rss_url ] %] [% map_html %] -[% IF children.size %] +[% IF c.cobrand.moniker != 'fixmystreet' AND children.size %] <h2 style="clear:right">[% loc('Wards of this council') %]</h2> <p>[% loc('Follow a ward link to view only reports within that ward.') %]</p> <ul> @@ -31,8 +32,16 @@ </div> <div id="side"> +<h1 id="reports_heading"> + [% IF ward %] + [% ward.name %]<span>, </span><a href="[% council_url %]">[% council.name %]</a> + [% ELSE %] + [% council.name %] + [% END %] +</h1> + [% IF council.generation_high == 10 AND c.cobrand.country == 'GB' %] -<p id="unknown">This council no longer exists. +<p id="unknown" class="alert">This council no longer exists. [% IF council.name.match('Penwith|Kerrier|Carrick|Restormel|Caradon|North Cornwall') %] Its area is now covered by <a href="/reports/Cornwall">Cornwall Council</a>. [% ELSIF council.name.match('Durham|Easington|Sedgefield|Teesdale|Wear Valley|Derwentside|Chester le Street') %] @@ -57,60 +66,49 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>. [% END %] </p> +[% ELSIF c.cobrand.moniker == 'fixmystreet' %] + <div class="shadow-wrap"> + <ul id="key-tools"[% IF NOT children.size %] class="singleton"[% END %]> + <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[% tprintf(loc('Get updates of problems in this %s'), thing) %]</a></li> + [% IF children.size %] + <li><a href="#council_wards" id="key-tool-wards" class="chevron">[% loc('Wards of this council') %]</a></li> + [% END %] + </ul> + </div> [% ELSE %] -<p><a href="[% rss_url %]"><img align="right" src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% tprintf(loc('RSS feed of problems in this %s'), thing) %]" border="0" hspace="4"></a> + <p><a href="[% rss_url %]"><img align="right" src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% tprintf(loc('RSS feed of problems in this %s'), thing) %]" border="0" hspace="4"></a> [% END %] -[% IF c.cobrand.all_councils_report %] - [% tprintf( loc('This is a summary of all reports for one %s.'), thing ) %] -[% ELSE %] - [% tprintf( loc('This is a summary of all reports for this %s.'), thing ) %] -[% END %] +[% INCLUDE 'reports/cobrand_stats.html' %] -[% IF ward %] -[% tprintf( loc('You can <a href="%s">view all reports for the council</a> or <a href="/reports">show all councils</a>.'), council_url ) %] -[% ELSE %] -[% loc('You can <a href="/reports">show all councils</a>.') %] +[% IF c.cobrand.moniker == 'fixmystreet' AND children.size %] +<section id="council_wards" class="hidden-js"> + <h2>[% loc('Wards of this council') %]</h2> + <p>[% loc('Follow a ward link to view only reports within that ward.') %]</p> + <ul class="issue-list-a full-width"> + [% FOR child IN children.values.sort('name') %] + <li><a href="[% child.url %]"><span class="text">[% child.name %]</span></a></li> + [% END %] + </ul> +</section> [% END %] -<h2>[% name %]</h2> - -[% INCLUDE 'reports/cobrand_stats.html' %] +[% IF c.cobrand.moniker == 'fixmystreet' %] +<p class="promo"> + FixMyStreet is now available for local council websites. + <a href="/for-councils">Find out more</a>. +</p> +[% END %] - [% INCLUDE 'pagination.html', param = 'p' %] +[% INCLUDE 'pagination.html', param = 'p' %] +<section class="full-width"> [% INCLUDE column - title = loc('Recently fixed') - problems = fixed.${council.id}.new + problems = problems.${council.id} %] +</section> - [% INCLUDE column - title = loc('New problems') - problems = open.${council.id}.new - %] - - [%# This doesn't really need a whole separate template %] - [% IF c.cobrand.moniker == 'emptyhomes' %] - [% - INCLUDE column - title = loc('Older problems') - problems = open.${council.id}.older.merge( open.${council.id}.unknown ) - %] - [% ELSE %] - [% INCLUDE column - title = loc('Older problems') - problems = open.${council.id}.older - %] - [% INCLUDE column - title = loc('Old problems, state unknown') - problems = open.${council.id}.unknown - %] - [% END %] - - [% INCLUDE column - title = loc('Old fixed') - problems = fixed.${council.id}.old - %] +[% INCLUDE 'pagination.html', param = 'p' %] </div> [% INCLUDE 'footer.html' %] @@ -118,9 +116,35 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a [% BLOCK column %] [% IF problems %] -<h3>[% title %]</h3> +<ul class="issue-list-a"> +[% IF c.cobrand.moniker == 'fixmystreet' %] + +[% FOREACH problem IN problems %] + <li> + <a href="[% c.uri_for('/report/' _ problem.id) %]"> + <div class="text"> + <h4>[% problem.title | html %]</h4> + <small>[% prettify_epoch( problem.confirmed, 1 ) %] + [%- IF problem.confirmed != problem.lastupdate %], last updated [% prettify_epoch( problem.lastupdate, 1 ) %] + [%- END %]</small> + [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> + [% ELSIF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small> + [% END %] + [% IF problem.is_fixed %] + <small>[% loc('(fixed)') %]</small> + [% END %] + </div> + [% IF problem.photo %] + <div class="img"> + <img height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt=""> + </div> + [% END %] + </a> + </li> +[% END %] + +[% ELSE %] -<ul> [% FOREACH problem IN problems %] <li><a href="[% c.uri_for('/report/' _ problem.id) %]">[% problem.title | html %]</a> [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %] @@ -129,6 +153,8 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a [% END %] </li> [% END %] + +[% END %] </ul> [% END %] diff --git a/templates/web/default/reports/index.html b/templates/web/default/reports/index.html index f14fd079e..283df5285 100755 --- a/templates/web/default/reports/index.html +++ b/templates/web/default/reports/index.html @@ -1,35 +1,41 @@ -[% INCLUDE 'header.html', title = loc('Summary reports') %] +[% INCLUDE 'header.html', title = loc('Summary reports'), bodyclass => 'fullwidthpage' %] +<h1>[% loc('All Reports') %]</h1> + +<div class="intro"> <p> [% loc('This is a summary of all reports on this site; select a particular council to see the reports sent there.') %] [% loc('Greyed-out lines are councils that no longer exist.') %] </p> +</div> -<table cellpadding="3" cellspacing="1" border="0"> +<table cellpadding="3" cellspacing="1" border="0" class="nicetable"> +<thead> <tr> -<th>[% loc('Name') %]</th> -<th>[% loc('New problems') %]</th> -<th>[% loc('Older problems') %]</th> -<th>[% loc('Old problems,<br>state unknown') %]</th> -<th>[% loc('Recently fixed') %]</th> -<th>[% loc('Older fixed') %]</th> +<th class="title">[% loc('Name') %]</th> +<th class="data">[% loc('New <br>problems') %]</th> +<th class="data">[% loc('Older <br>problems') %]</th> +<th class="data">[% loc('Old / unknown <br>problems') %]</th> +<th class="data">[% loc('Recently <br>fixed') %]</th> +<th class="data">[% loc('Older <br>fixed') %]</th> </tr> +</thead> +<tbody> [% FOREACH area IN areas_info_sorted %] <tr align="center" [%- IF area.generation_high == 10 %] class="gone" -[%- ELSIF loop.count % 2 %] class="a" -[%- END -%] -> -<td align="left"><a href="[% area.url %]">[% area.name %]</a></td> -<td>[% open.${area.id}.new or 0 %]</td> -<td>[% open.${area.id}.older or 0 %]</td> -<td>[% open.${area.id}.unknown or 0 %]</td> -<td>[% fixed.${area.id}.new or 0 %]</td> -<td>[% fixed.${area.id}.old or 0 %]</td> +[%- ELSIF ! (loop.count % 2) %] class="a" +[%- END %]> +<td class="title"><a href="[% area.url %]">[% area.name %]</a></td> +<td class="data">[% open.${area.id}.new or 0 %]</td> +<td class="data">[% open.${area.id}.older or 0 %]</td> +<td class="data">[% open.${area.id}.unknown or 0 %]</td> +<td class="data">[% fixed.${area.id}.new or 0 %]</td> +<td class="data">[% fixed.${area.id}.old or 0 %]</td> </tr> [% END %] +</tbody> </table> -[% INCLUDE 'footer.html' %] - +[% INCLUDE 'footer.html', pagefooter = 'yes' %] diff --git a/templates/web/fixmystreet/reports/cobrand_stats.html b/templates/web/fixmystreet/reports/cobrand_stats.html deleted file mode 100644 index e69de29bb..000000000 --- a/templates/web/fixmystreet/reports/cobrand_stats.html +++ /dev/null diff --git a/templates/web/fixmystreet/reports/council.html b/templates/web/fixmystreet/reports/council.html deleted file mode 100755 index cf5729fb3..000000000 --- a/templates/web/fixmystreet/reports/council.html +++ /dev/null @@ -1,131 +0,0 @@ -[% IF ward %] - [% name = "$ward.name, $council.name" - thing = loc('ward') - %] -[% ELSE %] - [% name = council.name - thing = loc('council') - %] -[% END %] - -[% - PROCESS "maps/${map.type}.html"; - INCLUDE 'header.html', - title = tprintf(loc('%s - Summary reports'), name) - context = 'reports' - bodyclass = 'mappage' - rss = [ tprintf(loc('Problems within %s, FixMyStreet'), name), rss_url ] -%] - -[% map_html %] -</div> - -<div id="side"> - -<h1 id="reports_heading"> - [% IF ward %] - [% ward.name %]<span>, </span><a href="[% council_url %]">[% council.name %]</a> - [% ELSE %] - [% council.name %] - [% END %] -</h1> - -[% IF council.generation_high == 10 AND c.cobrand.country == 'GB' %] - <p class="alert">This council no longer exists. - [% IF council.name.match('Penwith|Kerrier|Carrick|Restormel|Caradon|North Cornwall') %] - Its area is now covered by <a href="/reports/Cornwall">Cornwall Council</a>. - [% ELSIF council.name.match('Durham|Easington|Sedgefield|Teesdale|Wear Valley|Derwentside|Chester le Street') %] - Its area is now covered by <a href="/reports/Durham+County">Durham County Council</a>. - [% ELSIF council.name.match('Blyth Valley|Wansbeck|Castle Morpeth|Tynedale|Alnwick|Berwick upon Tweed') %] - Its area is now covered by <a href="/reports/Northumberland">Northumberland County Council</a>. - [% ELSIF council.name.match('North Shropshire|Oswestry|Shrewsbury and Atcham|South Shropshire|Bridgnorth') %] - Its area is now covered by <a href="/reports/Shropshire">Shropshire Council</a>. - [% ELSIF council.name.match('Salisbury|West Wiltshire|Kennet|North Wiltshire') %] - Its area is now covered by <a href="/reports/Wiltshire">Wiltshire Council</a>. - [% ELSIF council.name.match('Ellesmere Port and Neston|Vale Royal|Chester') %] - Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a>. - [% ELSIF council.name.match('Macclesfield|Congleton|Crewe and Nantwich') %] - Its area is now covered by <a href="/reports/Cheshire+East">Cheshire East Council</a>. - [% ELSIF council.name.match('Mid Bedfordshire|South Bedfordshire') %] - Its area is now covered by <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>. - [% ELSIF council.name.match('Cheshire') %] - Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a> or - <a href="/reports/Cheshire+East">Cheshire East Council</a>. - [% ELSIF council.name.match('Bedfordshire') %] - Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a> or - <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>. - [% END %] - </p> -[% ELSE %] - <div class="shadow-wrap"> - <ul id="key-tools"[% IF NOT children.size %] class="singleton"[% END %]> - <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[% tprintf(loc('Get updates of problems in this %s'), thing) %]</a></li> - [% IF children.size %] - <li><a href="#council_wards" id="key-tool-wards" class="chevron">[% loc('Wards of this council') %]</a></li> - [% END %] - </ul> - </div> -[% END %] - -[% INCLUDE 'reports/cobrand_stats.html' %] - -[% IF children.size %] -<section id="council_wards" class="hidden-js"> - <h2>[% loc('Wards of this council') %]</h2> - <p>[% loc('Follow a ward link to view only reports within that ward.') %]</p> - <ul class="issue-list-a full-width"> - [% FOR child IN children.values.sort('name') %] - <li><a href="[% child.url %]"><span class="text">[% child.name %]</span></a></li> - [% END %] - </ul> -</section> -[% END %] - -[% IF c.cobrand.moniker == 'fixmystreet' %] -<p class="promo"> - FixMyStreet is now available for local council websites. - <a href="/for-councils">Find out more</a>. -</p> -[% END %] - -[% INCLUDE 'pagination.html', param = 'p' %] - -<section class="full-width"> - [% INCLUDE column - problems = problems.${council.id} - %] -</section> - -[% INCLUDE 'pagination.html', param = 'p' %] - -</div> -[% INCLUDE 'footer.html' %] - -[% BLOCK column %] -[% IF problems %] - -<ul class="issue-list-a"> -[% FOREACH problem IN problems %] - <li> - <a href="[% c.uri_for('/report/' _ problem.id) %]"> - <div class="text"> - <h4>[% problem.title | html %]</h4> - <small>[% prettify_epoch( problem.confirmed, 1 ) %]</small> - [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %] - [% IF c.cobrand.moniker != 'emptyhomes' %] - [% IF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small> [% END %] - [% END %] - </div> - [% IF problem.photo %] - <div class="img"> - <img height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt=""> - </div> - [% END %] - </a> - </li> -[% END %] -</ul> - -[% END %] -[% END %] - diff --git a/templates/web/fixmystreet/reports/index.html b/templates/web/fixmystreet/reports/index.html deleted file mode 100755 index 96367d4bb..000000000 --- a/templates/web/fixmystreet/reports/index.html +++ /dev/null @@ -1,37 +0,0 @@ -[% INCLUDE 'header.html', title = loc('Summary reports'), bodyclass => 'fullwidthpage' %] - -<h1>[% loc('All Reports') %]</h1> - -<div class="intro"> - <p> - [% loc('This is a summary of all reports on this site; select a particular council to see the reports sent there.') %] - [% loc('Greyed-out lines are councils that no longer exist.') %] - </p> -</div> - -<table cellpadding="3" cellspacing="1" border="0" class="nicetable"> - <thead> - <th class="title">[% loc('Name') %]</th> - <th class="data">[% loc('New <br>problems') %]</th> - <th class="data">[% loc('Older <br>problems') %]</th> - <th class="data">[% loc('Old / unknown <br>problems') %]</th> - <th class="data">[% loc('Recently <br>fixed') %]</th> - <th class="data">[% loc('Older <br>fixed') %]</th> - </thead> - - [% FOREACH area IN areas_info_sorted %] - <tr align="center" - [%- IF area.generation_high == 10 %] class="gone" - [%- ELSIF ! (loop.count % 2) %] class="a" - [%- END %]> - <td class="title"><a href="[% area.url %]">[% area.name %]</a></td> - <td class="data">[% open.${area.id}.new or 0 %]</td> - <td class="data">[% open.${area.id}.older or 0 %]</td> - <td class="data">[% open.${area.id}.unknown or 0 %]</td> - <td class="data">[% fixed.${area.id}.new or 0 %]</td> - <td class="data">[% fixed.${area.id}.old or 0 %]</td> - </tr> - [% END %] -</table> - -[% INCLUDE 'footer.html' pagefooter => 'yes' %] diff --git a/templates/web/fixmystreet/reports/ward.html b/templates/web/fixmystreet/reports/ward.html deleted file mode 100755 index 8b65ffb28..000000000 --- a/templates/web/fixmystreet/reports/ward.html +++ /dev/null @@ -1 +0,0 @@ -[% INCLUDE reports/council.html %] |