diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 3 | ||||
-rw-r--r-- | t/cobrand/fixmystreet.t | 26 | ||||
-rwxr-xr-x | templates/web/base/reports/index.html | 54 | ||||
-rw-r--r-- | web/cobrands/sass/_dashboard.scss | 22 |
4 files changed, 100 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index ed9e5bdea..2153ca33b 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -80,6 +80,9 @@ sub council_dashboard_hook { $c->detach; } + $c->forward('/admin/fetch_contacts'); + $c->stash->{display_contacts} = 1; + return if $c->user->is_superuser; my $body = $c->user->from_body || _user_to_body($c); diff --git a/t/cobrand/fixmystreet.t b/t/cobrand/fixmystreet.t index eda93e187..4d76e43c6 100644 --- a/t/cobrand/fixmystreet.t +++ b/t/cobrand/fixmystreet.t @@ -5,6 +5,12 @@ my $mech = FixMyStreet::TestMech->new; my $body = $mech->create_body_ok( 2514, 'Birmingham' ); +my $contact = $mech->create_contact_ok( + body_id => $body->id, + category => 'Traffic lights', + email => 'lights@example.com' +); + my $data; FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', @@ -39,7 +45,27 @@ FixMyStreet::override_config { $mech->get_ok('/about/council-dashboard'); is $mech->uri->path, '/reports/Birmingham/summary'; $mech->content_contains('Top 5 wards'); + $mech->content_contains('Where we send Birmingham'); + $mech->content_contains('lights@example.com'); + + $body->send_method('Open311'); + $body->update(); + $mech->get_ok('/about/council-dashboard'); + $mech->content_contains('Reports to Birmingham are currently sent directly'); + + $body->send_method('Refused'); + $body->update(); + $mech->get_ok('/about/council-dashboard'); + $mech->content_contains('Birmingham currently does not accept'); + + $body->send_method('Noop'); + $body->update(); + $mech->get_ok('/about/council-dashboard'); + $mech->content_contains('Reports are currently not being sent'); + $mech->log_out_ok(); + $mech->get_ok('/reports'); + $mech->content_lacks('Where we send Birmingham'); }; END { diff --git a/templates/web/base/reports/index.html b/templates/web/base/reports/index.html index 70f4b3929..ff812f113 100755 --- a/templates/web/base/reports/index.html +++ b/templates/web/base/reports/index.html @@ -139,4 +139,58 @@ </div> </div> +[% IF display_contacts %] +<div class="dashboard-row"> + <div class="dashboard-item dashboard-item--12"> + <h2 class="dashboard-subheading">[% tprintf( loc('Where we send %s reports'), body.name ) %]</h2> + [% IF body.send_method == 'Refused' %] + <p> + [% tprintf( loc('%s currently does not accept reports from FixMyStreet.'), body.name) %] + </p> + + <p> + [% loc('If you’d like to discuss this then <a href="/contact">get in touch</a>.') %] + </p> + [% ELSIF body.send_method == 'Noop' %] + <p> + [% tprintf( loc('Reports are currently not being sent to %s.'), body.name ) %] + </p> + [% ELSIF body.send_method != 'Email' AND body.send_method != '' %] + <p> + [% tprintf( loc('Reports to %s are currently sent directly into backend services.'), body.name) %] + </p> + [% ELSE %] + <p> + [% loc('We currently send all reports to the email addresses below.') %] + </p> + + <p> + [% loc('Did you know that if you used the approved open standard Open311 you could send reports directly into your own backend services – and get much more control over what additional information you request?') %] + </p> + + <p> + [% loc('If that’s new to you, <a href="https://www.mysociety.org/2013/01/10/open311-introduced/">take a look at our simple Open311 primer</a> to see what you need to do to get up and running in a few days.') %] + </p> + + <p> + [% loc('If you would like to change either the categories or the contact emails below then <a href="/contact">get in touch</a>.') %] + <p> + <table class="dashboard-contacts-table"> + <tr> + <th>[% loc('Category') %]</th> + <th>[% loc('Contact') %]</th> + </tr> + [% WHILE ( cat = live_contacts.next ) %] + <tr> + <td class="contact-category"><a href="[% c.uri_for( 'body', body_id, cat.category ) %]">[% cat.category_display | html %]</a> + </td> + <td>[% cat.email | html %]</td> + </tr> + [% END %] + </table> + [% END %] + </div> +</div> +[% END %] + [% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/web/cobrands/sass/_dashboard.scss b/web/cobrands/sass/_dashboard.scss index fe35df8e3..396d53d56 100644 --- a/web/cobrands/sass/_dashboard.scss +++ b/web/cobrands/sass/_dashboard.scss @@ -184,15 +184,12 @@ } } -.dashboard-ranking-table { +.dashboard-ranking-table, +.dashboard-contacts-table { width: 100%; td { padding: 0.4em 0.8em; - - &:last-child { - text-align: $right; - } } tbody tr:nth-child(odd) { @@ -205,3 +202,18 @@ font-weight: bold; } } + +.dashboard-ranking-table { + td { + &:last-child { + text-align: $right; + } + } +} + +.dashboard-contacts-table { + th { + text-align: $left; + padding: 0.4em 0.8em; + } +} |