diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-07 14:01:39 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 11:12:12 +0100 |
commit | f604fb2765b2845ddf5c8ba12832348e9d59016c (patch) | |
tree | 2a2f61cac11baf3cec3f854da12bebb8e9684057 | |
parent | 22226c7893167ebdb86363587cd1635a9b717ece (diff) |
New version of /reports main page.
This is a much broader summary page, plus a body name autocomplete.
This was originally implemented for fixmystreet.com in 8a6a4ccb7.
It also adds '(no longer exists)' in the autocomplete next to
bodies not covering any areas.
You can supply the `--table` argument to `update-all-reports` to
generate the old-style data.
-rwxr-xr-x | bin/update-all-reports | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 25 | ||||
-rw-r--r-- | t/app/controller/reports.t | 74 | ||||
-rwxr-xr-x | templates/web/base/reports/index.html | 147 | ||||
-rwxr-xr-x | templates/web/fixmystreet.com/reports/index.html | 111 | ||||
-rw-r--r-- | web/cobrands/fixmystreet.com/base.scss | 3 | ||||
-rw-r--r-- | web/cobrands/sass/_autocomplete.scss (renamed from web/cobrands/fixmystreet.com/_autocomplete.scss) | 0 | ||||
-rw-r--r-- | web/cobrands/sass/_base.scss | 2 | ||||
-rw-r--r-- | web/cobrands/sass/_dashboard.scss (renamed from web/cobrands/fixmystreet.com/_dashboard.scss) | 0 | ||||
-rw-r--r-- | web/js/dashboard.js (renamed from web/cobrands/fixmystreet.com/dashboard.js) | 0 |
11 files changed, 142 insertions, 249 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports index 02f9fda78..250901312 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -21,13 +21,13 @@ use Getopt::Long::Descriptive; my ($opt, $usage) = describe_options( '%c %o', - [ 'dashboard', "Output JSON for new dashboard-style page." ], + [ 'table', "Output JSON for old table-style page." ], [ 'help', "print usage message and exit", { shortcircuit => 1 } ], ); print($usage->text), exit if $opt->help; -if ($opt->dashboard) { - FixMyStreet::Script::UpdateAllReports::generate_dashboard(); -} else { +if ($opt->table) { FixMyStreet::Script::UpdateAllReports::generate(); +} else { + FixMyStreet::Script::UpdateAllReports::generate_dashboard(); } diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 024a23872..8f068f0ec 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -384,8 +384,6 @@ sub load_and_group_problems : Private { $c->forward('stash_report_sort', [ $c->cobrand->reports_ordering ]); my $page = $c->get_param('p') || 1; - # NB: If 't' is specified, it will override 'status'. - my $type = $c->get_param('t') || 'all'; my $category = [ $c->get_param_list('filter_category', 1) ]; my $states = $c->stash->{filter_problem_states}; @@ -413,25 +411,6 @@ sub load_and_group_problems : Private { $where->{'me.id'} = { -not_in => $shortlisted_ids }; } - my $not_open = [ FixMyStreet::DB::Result::Problem::fixed_states(), FixMyStreet::DB::Result::Problem::closed_states() ]; - if ( $type eq 'new' ) { - $where->{confirmed} = { '>', \"current_timestamp - INTERVAL '4 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'older' ) { - $where->{confirmed} = { '<', \"current_timestamp - INTERVAL '4 week'" }; - $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'unknown' ) { - $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'fixed' ) { - $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = $not_open; - } elsif ( $type eq 'older_fixed' ) { - $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = $not_open; - } - if (@$category) { $where->{category} = $category; } diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 92588a598..aebf7d70c 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -485,31 +485,6 @@ sub extract_problem_list { return $result->{ problems } || []; } -=head2 extract_report_stats - - $stats = $mech->extract_report_stats - -Returns a hash ref keyed by council name of all the council stats from the all reports -page. Each value is an array ref with the first element being the council name and the -rest being the stats in the order the appear in each row. - -=cut - -sub extract_report_stats { - my $mech = shift; - - my $result = scraper { - process 'tr[align=center]', 'councils[]' => scraper { - process 'td.title a', 'council', 'TEXT', - process 'td', 'stats[]', 'TEXT' - } - }->scrape( $mech->response ); - - my %councils = map { $_->{council} => $_->{stats} } @{ $result->{councils} }; - - return \%councils; -} - =head2 visible_form_values $hashref = $mech->visible_form_values( ); diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 209266940..464a78c24 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -1,8 +1,14 @@ +use Test::MockTime qw(:all); use FixMyStreet::TestMech; use mySociety::MaPit; use FixMyStreet::App; use DateTime; +set_absolute_time('2017-07-07T16:00:00'); +END { + restore_time; +} + ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); $mech->create_body_ok(2514, 'Birmingham City Council'); @@ -11,9 +17,9 @@ my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id; my $body_fife_id = $mech->create_body_ok(2649, 'Fife Council')->id; my $body_slash_id = $mech->create_body_ok(10000, 'Electricity/Gas Council')->id; -my @edinburgh_problems = $mech->create_problems_for_body(3, $body_edin_id, 'All reports'); -my @westminster_problems = $mech->create_problems_for_body(5, $body_west_id, 'All reports'); -my @fife_problems = $mech->create_problems_for_body(15, $body_fife_id, 'All reports'); +my @edinburgh_problems = $mech->create_problems_for_body(3, $body_edin_id, 'All reports', { category => 'Potholes' }); +my @westminster_problems = $mech->create_problems_for_body(5, $body_west_id, 'All reports', { category => 'Graffiti' }); +my @fife_problems = $mech->create_problems_for_body(15, $body_fife_id, 'All reports', { category => 'Flytipping' }); is scalar @westminster_problems, 5, 'correct number of westminster problems created'; is scalar @edinburgh_problems, 3, 'correct number of edinburgh problems created'; @@ -80,30 +86,21 @@ $fife_problems[10]->update( { # Run the cron script that makes the data for /reports so we don't get an error. use FixMyStreet::Script::UpdateAllReports; -FixMyStreet::Script::UpdateAllReports::generate(); +FixMyStreet::Script::UpdateAllReports::generate_dashboard(); # check that we can get the page $mech->get_ok('/reports'); -$mech->title_like(qr{Summary reports}); +$mech->title_like(qr{Dashboard}); $mech->content_contains('Birmingham'); -my $stats = $mech->extract_report_stats; - -is $stats->{'City of Edinburgh Council'}->[1], 2, 'correct number of new reports for Edinburgh'; -is $stats->{'City of Edinburgh Council'}->[2], 1, 'correct number of older reports for Edinburgh'; - -is $stats->{'Westminster City Council'}->[1], 5, 'correct number of reports for Westminster'; - -is $stats->{'Fife Council'}->[1], 5, 'correct number of new reports for Fife'; -is $stats->{'Fife Council'}->[2], 4, 'correct number of old reports for Fife'; -is $stats->{'Fife Council'}->[3], 1, 'correct number of unknown reports for Fife'; -is $stats->{'Fife Council'}->[4], 3, 'correct number of fixed reports for Fife'; -is $stats->{'Fife Council'}->[5], 1, 'correct number of older fixed reports for Fife'; +$mech->content_contains('"Apr","May","Jun","Jul"'); +$mech->content_contains('5,9,10,22'); +$mech->content_contains('2,3,4,4'); FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); + $mech->submit_form_ok( { with_fields => { body => $body_edin_id } }, 'Submitted dropdown okay' ); $mech->get_ok('/reports/Westminster'); }; @@ -118,54 +115,44 @@ FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports'); - $mech->follow_link_ok({ url_regex => qr{/reports/Electricity_Gas\+Council} }); + $mech->submit_form_ok({ with_fields => { body => $body_slash_id } }, 'Submitted dropdown okay'); is $mech->uri->path, '/reports/Electricity_Gas+Council', 'Path is correct'; - $mech->get_ok('/reports/City+of+Edinburgh?t=new'); + $mech->get_ok('/reports/City+of+Edinburgh?status=open'); }; $problems = $mech->extract_problem_list; -is scalar @$problems, 2, 'correct number of new problems displayed'; +is scalar @$problems, 3, 'correct number of open problems displayed'; FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->get_ok('/reports/City+of+Edinburgh?t=older'); + $mech->get_ok('/reports/City+of+Edinburgh?status=closed'); }; $problems = $mech->extract_problem_list; -is scalar @$problems, 1, 'correct number of older problems displayed'; +is scalar @$problems, 0, 'correct number of closed problems displayed'; for my $test ( { - desc => 'new fife problems on report page', - type => 'new', - expected => 5 + desc => 'open fife problems on report page', + type => 'open', + expected => 10 }, { - desc => 'older fife problems on report page', - type => 'older', - expected => 4 - }, - { - desc => 'unknown fife problems on report page', - type => 'unknown', - expected => 1 + desc => 'closed fife problems on report page', + type => 'closed', + expected => 0 }, { desc => 'fixed fife problems on report page', type => 'fixed', - expected => 3 - }, - { - desc => 'older_fixed fife problems on report page', - type => 'older_fixed', - expected => 1 + expected => 4 }, ) { subtest $test->{desc} => sub { FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->get_ok('/reports/Fife+Council?t=' . $test->{type}); + $mech->get_ok('/reports/Fife+Council?status=' . $test->{type}); }; $problems = $mech->extract_problem_list; @@ -186,9 +173,10 @@ is scalar @$problems, 4, 'only public problems are displayed'; $mech->content_lacks('All reports Test 3 for ' . $body_west_id, 'non public problem is not visible'); +# No change to numbers if report is non-public $mech->get_ok('/reports'); -$stats = $mech->extract_report_stats; -is $stats->{'Westminster City Council'}->[1], 5, 'non public reports included in stats'; +$mech->content_contains('"Apr","May","Jun","Jul"'); +$mech->content_contains('5,9,10,22'); subtest "test fiksgatami all reports page" => sub { FixMyStreet::override_config { diff --git a/templates/web/base/reports/index.html b/templates/web/base/reports/index.html index b07227144..a653a2686 100755 --- a/templates/web/base/reports/index.html +++ b/templates/web/base/reports/index.html @@ -1,50 +1,113 @@ +[% USE Number.Format -%] [% extra_js = [ - version('/js/jquery.fixedthead.js') + version('/vendor/chart.min.js'), + version('/vendor/accessible-autocomplete.min.js'), + version('/js/dashboard.js') ] -%] -[% INCLUDE 'header.html', title = loc('Summary reports'), bodyclass => 'fullwidthpage' %] +[% + problems_reported = problems_reported_by_period.last | format_number; + problems_fixed = problems_fixed_by_period.last | format_number; + last_seven_reported = last_seven_days.problems_total | format_number; + last_seven_updated = last_seven_days.updated_total | format_number; + last_seven_fixed = last_seven_days.fixed_total | format_number; + other_categories_formatted = other_categories | format_number; +-%] +[% INCLUDE 'header.html', title = loc('Dashboard'), bodyclass => 'dashboard fullwidthpage' %] -<h1>[% loc('All Reports') %]</h1> +<div class="dashboard-header"> + <h1>[% loc('Dashboard') %]</h1> +</div> -<div class="intro"> -<p> - [% loc('This is a summary of all reports on this site.') %] - [% IF bodies.size > 1 %] - [% loc('Select a particular council to see the reports sent there.') %] - [% END %] - [% IF any_empty_bodies %] - [% loc('Greyed-out lines are councils that no longer exist.') %] - [% END %] -</p> +<div class="dashboard-row"> + <div class="dashboard-item dashboard-item--12"> + <h2>[% loc('All time') %]</h2> + <div class="labelled-line-chart"> + <canvas id="chart-all-reports" width="600" height="300" + data-labels="["[% problem_periods.join('","') %]"]" + data-values-reports="[[% problems_reported_by_period.join(',') %]]" + data-values-fixed="[[% problems_fixed_by_period.join(',') %]]" + ></canvas> + <span class="label" data-datasetindex="0"><strong style="color: #F4A140">[% tprintf(nget("%s problem reported", "%s problems reported", problems_reported_by_period.last), decode(problems_reported) _ '</strong>') %]</span> + <span class="label" data-datasetindex="1"><strong style="color: #62B356">[% tprintf(nget("%s report marked as fixed", "%s reports marked as fixed", problems_fixed_by_period.last), decode(problems_fixed) _ '</strong>') %]</span> + </div> + </div> </div> -<table cellpadding="3" cellspacing="1" border="0" class="nicetable"> -<thead> -<tr> -<th class="title">[% loc('Name') %]</th> -<th title="[% loc('Reported within the last four weeks') %]" class="data">[% loc('New <br>problems') %]</th> -<th title="[% loc('Open for more than four weeks, with an update within the past eight weeks') %]" class="data">[% loc('Older <br>problems') %]</th> -<th title="[% loc('Open, but not had any update in eight weeks') %]" class="data">[% loc('Old / unknown <br>problems') %]</th> -<th title="[% loc('Marked fixed/closed in the past eight weeks') %]" class="data">[% loc('Recently <br>fixed') %]</th> -<th title="[% loc('Marked fixed/closed more than eight weeks ago') %]" class="data">[% loc('Older <br>fixed') %]</th> -</tr> -</thead> +<div class="dashboard-row"> + <div class="dashboard-item dashboard-item--6"> + <h2 class="dashboard-subheading">[% loc('Last 7 days') %]</h2> + <div class="dashboard-sparklines"> + <div> + <div class="labelled-sparkline"> + <canvas width="200" height="50" data-color="#F4A140" data-values="[% last_seven_days.problems.join(' ') %]"></canvas> + <span class="label" data-datasetindex="0"><strong style="color: #F4A140;">[% tprintf(nget("%s problem reported", "%s problems reported", last_seven_days.problems_total), decode(last_seven_reported) _ '</strong>') %]</span> + </div> + </div> + <div> + <div class="labelled-sparkline"> + <canvas width="200" height="50" data-color="#4FADED" data-values="[% last_seven_days.updated.join(' ') %]"></canvas> + <span class="label" data-datasetindex="0"><strong style="color: #4FADED;">[% tprintf(nget("%s update on problems", "%s updates on problems", last_seven_days.updated_total), decode(last_seven_updated) _ '</strong>') %]</span> + </div> + </div> + <div> + <div class="labelled-sparkline"> + <canvas width="200" height="50" data-color="#62B356" data-values="[% last_seven_days.fixed.join(' ') %]"></canvas> + <span class="label" data-datasetindex="0"><strong style="color: #62B356;">[% tprintf(nget("%s problem marked as fixed", "%s problems marked as fixed", last_seven_days.fixed_total), decode(last_seven_fixed) _ '</strong>') %]</span> + </div> + </div> + </div> + </div> + <div class="dashboard-item dashboard-item--6"> + <form class="dashboard-search" action="/reports"> + <h2>[% loc('Show reports in your area') %]</h2> + <label for="body">[% loc('Pick your council') %]</label> + <div class="dashboard-search__input"> + <select id="body" name="body" class="js-autocomplete"> + <option value="">[% loc('Pick your council') %]</option> + [% FOR body IN bodies %] + <option value="[% body.id %]">[% body.name | html ~%] + [% IF NOT body.get_column("area_count") %] [% loc('(no longer exists)') %][% END ~%] + </option> + [% END %] + </select> + </div> + <div class="dashboard-search__submit"> + <input type="submit" value="[% loc('Go') %]"> + </div> + </form> + </div> +</div> -<tbody> -[% FOREACH body IN bodies %] -<tr align="center" -[%- IF NOT body.get_column("area_count") %] class="gone" -[%- ELSIF ! (loop.count % 2) %] class="a" -[%- END %]> -<td class="title"><a href="[% body.url(c) %]">[% body.name %]</a></td> -<td class="data">[% IF open.${body.id}.new %]<a href="[% body.url(c, { t => 'new' }) %]">[% open.${body.id}.new %]</a>[% ELSE %]0[% END %]</td> -<td class="data">[% IF open.${body.id}.older %]<a href="[% body.url(c, { t => 'older' }) %]">[% open.${body.id}.older %]</a>[% ELSE %]0[% END %]</td> -<td class="data">[% IF open.${body.id}.unknown %]<a href="[% body.url(c, { t => 'unknown' }) %]">[% open.${body.id}.unknown %]</a>[% ELSE %]0[% END %]</td> -<td class="data">[% IF fixed.${body.id}.new %]<a href="[% body.url(c, { t => 'fixed' }) %]">[% fixed.${body.id}.new %]</a>[% ELSE %]0[% END %]</td> -<td class="data">[% IF fixed.${body.id}.old %]<a href="[% body.url(c, { t => 'older_fixed' }) %]">[% fixed.${body.id}.old %]</a>[% ELSE %]0[% END %]</td> -</tr> -[% TRY %][% PROCESS "reports/_extras.html" %][% CATCH file %][% END %] -[% END %] -</tbody> -</table> +<div class="dashboard-row"> + <div class="dashboard-item dashboard-item--6"> + <h2 class="dashboard-subheading">[% loc('Top 5 responsive councils') %]</h2> + <p>[% loc('Average time between a problem being reported and being fixed, last 100 reports.') %]</p> + <table class="dashboard-ranking-table"> + <tbody> + [% FOR line IN top_five_bodies %] + <tr><td>[% line.name %]</td><td>[% tprintf(nget("%s day", "%s days", line.days), line.days) %]</td></tr> + [% END %] + </tbody> + <tfoot> + <tr><td>[% loc('Overall average') %]</td><td>[% tprintf(nget("%s day", "%s days", average), average) %]</td></tr> + </tfoot> + </table> + </div> + <div class="dashboard-item dashboard-item--6"> + <h2 class="dashboard-subheading">[% loc('Top 5 most used categories') %]</h2> + <p>[% loc('Number of problems reported in each category, in the last 7 days.') %]</p> + <table class="dashboard-ranking-table"> + <tbody> + [% FOR line IN top_five_categories %] + [% line_count = line.count | format_number ~%] + <tr><td>[% line.category %]</td><td>[% tprintf(nget("%s report", "%s reports", line.count), decode(line_count)) %]</td></tr> + [% END %] + </tbody> + <tfoot> + <tr><td>[% loc('Other categories') %]</td><td>[% tprintf(nget("%s report", "%s reports", other_categories), decode(other_categories_formatted)) %]</td></tr> + </tfoot> + </table> + </div> +</div> -[% INCLUDE 'footer.html', pagefooter = 'yes' %] +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/fixmystreet.com/reports/index.html b/templates/web/fixmystreet.com/reports/index.html deleted file mode 100755 index 4eafb2993..000000000 --- a/templates/web/fixmystreet.com/reports/index.html +++ /dev/null @@ -1,111 +0,0 @@ -[% USE Number.Format -%] -[% extra_js = [ - version('/vendor/chart.min.js'), - version('/vendor/accessible-autocomplete.min.js'), - version('/cobrands/fixmystreet.com/dashboard.js') -] -%] -[% - problems_reported = problems_reported_by_period.last | format_number; - problems_fixed = problems_fixed_by_period.last | format_number; - last_seven_reported = last_seven_days.problems_total | format_number; - last_seven_updated = last_seven_days.updated_total | format_number; - last_seven_fixed = last_seven_days.fixed_total | format_number; - other_categories_formatted = other_categories | format_number; --%] -[% INCLUDE 'header.html', title = loc('Dashboard'), bodyclass => 'dashboard fullwidthpage' %] - -<div class="dashboard-header"> - <h1>[% loc('Dashboard') %]</h1> -</div> - -<div class="dashboard-row"> - <div class="dashboard-item dashboard-item--12"> - <h2>UK: [% loc('All time') %]</h2> - <div class="labelled-line-chart"> - <canvas id="chart-all-reports" width="600" height="300" - data-labels="["[% problem_periods.join('","') %]"]" - data-values-reports="[[% problems_reported_by_period.join(',') %]]" - data-values-fixed="[[% problems_fixed_by_period.join(',') %]]" - ></canvas> - <span class="label" data-datasetindex="0"><strong style="color: #F4A140">[% tprintf(nget("%s problem reported", "%s problems reported", problems_reported_by_period.last), decode(problems_reported) _ '</strong>') %]</span> - <span class="label" data-datasetindex="1"><strong style="color: #62B356">[% tprintf(nget("%s report marked as fixed", "%s reports marked as fixed", problems_fixed_by_period.last), decode(problems_fixed) _ '</strong>') %]</span> - </div> - </div> -</div> - -<div class="dashboard-row"> - <div class="dashboard-item dashboard-item--6"> - <h2 class="dashboard-subheading">UK: [% loc('Last 7 days') %]</h2> - <div class="dashboard-sparklines"> - <div> - <div class="labelled-sparkline"> - <canvas width="200" height="50" data-color="#F4A140" data-values="[% last_seven_days.problems.join(' ') %]"></canvas> - <span class="label" data-datasetindex="0"><strong style="color: #F4A140;">[% tprintf(nget("%s problem reported", "%s problems reported", last_seven_days.problems_total), decode(last_seven_reported) _ '</strong>') %]</span> - </div> - </div> - <div> - <div class="labelled-sparkline"> - <canvas width="200" height="50" data-color="#4FADED" data-values="[% last_seven_days.updated.join(' ') %]"></canvas> - <span class="label" data-datasetindex="0"><strong style="color: #4FADED;">[% tprintf(nget("%s update on problems", "%s updates on problems", last_seven_days.updated_total), decode(last_seven_updated) _ '</strong>') %]</span> - </div> - </div> - <div> - <div class="labelled-sparkline"> - <canvas width="200" height="50" data-color="#62B356" data-values="[% last_seven_days.fixed.join(' ') %]"></canvas> - <span class="label" data-datasetindex="0"><strong style="color: #62B356;">[% tprintf(nget("%s problem marked as fixed", "%s problems marked as fixed", last_seven_days.fixed_total), decode(last_seven_fixed) _ '</strong>') %]</span> - </div> - </div> - </div> - </div> - <div class="dashboard-item dashboard-item--6"> - <form class="dashboard-search" action="/reports"> - <h2>[% loc('Show reports in your area') %]</h2> - <label for="body">[% loc('Pick your council') %]</label> - <div class="dashboard-search__input"> - <select id="body" name="body" class="js-autocomplete"> - <option value="">[% loc('Pick your council') %]</option> - [% FOR body IN bodies %] - <option value="[% body.id %]">[% body.name | html %]</option> - [% END %] - </select> - </div> - <div class="dashboard-search__submit"> - <input type="submit" value="[% loc('Go') %]"> - </div> - </form> - </div> -</div> - -<div class="dashboard-row"> - <div class="dashboard-item dashboard-item--6"> - <h2 class="dashboard-subheading">[% loc('Top 5 responsive councils') %]</h2> - <p>[% loc('Average time between a problem being reported and being fixed, last 100 reports.') %]</p> - <table class="dashboard-ranking-table"> - <tbody> - [% FOR line IN top_five_bodies %] - <tr><td>[% line.name %]</td><td>[% tprintf(nget("%s day", "%s days", line.days), line.days) %]</td></tr> - [% END %] - </tbody> - <tfoot> - <tr><td>[% loc('UK average') %]</td><td>[% tprintf(nget("%s day", "%s days", average), average) %]</td></tr> - </tfoot> - </table> - </div> - <div class="dashboard-item dashboard-item--6"> - <h2 class="dashboard-subheading">[% loc('Top 5 most used categories') %]</h2> - <p>[% loc('Number of problems reported in each category, in the last 7 days.') %]</p> - <table class="dashboard-ranking-table"> - <tbody> - [% FOR line IN top_five_categories %] - [% line_count = line.count | format_number ~%] - <tr><td>[% line.category %]</td><td>[% tprintf(nget("%s report", "%s reports", line.count), decode(line_count)) %]</td></tr> - [% END %] - </tbody> - <tfoot> - <tr><td>[% loc('Other categories') %]</td><td>[% tprintf(nget("%s report", "%s reports", other_categories), decode(other_categories_formatted)) %]</td></tr> - </tfoot> - </table> - </div> -</div> - -[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/web/cobrands/fixmystreet.com/base.scss b/web/cobrands/fixmystreet.com/base.scss index c90b65c1a..4f2a7b1de 100644 --- a/web/cobrands/fixmystreet.com/base.scss +++ b/web/cobrands/fixmystreet.com/base.scss @@ -258,6 +258,3 @@ $grid-breakpoint-sm: $mysoc-footer-breakpoint-sm; margin-bottom: 0; } } - -@import "autocomplete"; -@import "dashboard"; diff --git a/web/cobrands/fixmystreet.com/_autocomplete.scss b/web/cobrands/sass/_autocomplete.scss index deebc1803..deebc1803 100644 --- a/web/cobrands/fixmystreet.com/_autocomplete.scss +++ b/web/cobrands/sass/_autocomplete.scss diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index a261c3b0a..87e474136 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -2429,3 +2429,5 @@ table.nicetable { @import "_fixedthead"; @import "_dropzone"; @import "_multiselect"; +@import "_autocomplete"; +@import "_dashboard"; diff --git a/web/cobrands/fixmystreet.com/_dashboard.scss b/web/cobrands/sass/_dashboard.scss index aae8aa98b..aae8aa98b 100644 --- a/web/cobrands/fixmystreet.com/_dashboard.scss +++ b/web/cobrands/sass/_dashboard.scss diff --git a/web/cobrands/fixmystreet.com/dashboard.js b/web/js/dashboard.js index f436b8d18..f436b8d18 100644 --- a/web/cobrands/fixmystreet.com/dashboard.js +++ b/web/js/dashboard.js |