aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-01-23 12:20:19 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-07-31 22:13:41 +0100
commit7e3742d37dbdab4e5be39230e4738457fecb34a4 (patch)
tree8a67d1095760120435f93df84fc079f7f76ae6be
parent8faf42a8d77f5e95840ed633bd21c32923ab2c51 (diff)
[Zurich] Show internal reports on their own page.
The new internal reports is displayed the same as the main summary, and all reports shows both internal/non-internal.
-rwxr-xr-xbin/zurich/overdue-alert1
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm7
-rw-r--r--t/cobrand/zurich.t14
-rw-r--r--templates/web/zurich/admin/problem_row.html3
-rw-r--r--templates/web/zurich/admin/reports/index.html2
-rw-r--r--templates/web/zurich/header.html11
6 files changed, 32 insertions, 6 deletions
diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert
index 7689c172f..b052d94d3 100755
--- a/bin/zurich/overdue-alert
+++ b/bin/zurich/overdue-alert
@@ -45,6 +45,7 @@ sub loop_through {
state => $states,
created => { '<', $date_threshold },
bodies_str => { '!=', undef },
+ non_public => 0,
} );
my %to_send = ();
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index e9fec8fda..be73ed9c1 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -468,6 +468,7 @@ sub admin {
my $self = shift;
my $c = $self->{c};
my $type = $c->stash->{admin_type};
+ my $internal = $c->get_param('internal');
if ($type eq 'dm') {
$c->stash->{template} = 'admin/index-dm.html';
@@ -482,12 +483,14 @@ sub admin {
$c->stash->{submitted} = $c->cobrand->problems->search({
state => [ 'submitted', 'confirmed' ],
bodies_str => $c->stash->{body}->id,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order,
});
$c->stash->{approval} = $c->cobrand->problems->search({
state => 'feedback pending',
bodies_str => $c->stash->{body}->id,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order,
});
@@ -496,6 +499,7 @@ sub admin {
$c->stash->{other} = $c->cobrand->problems->search({
state => { -not_in => [ 'submitted', 'confirmed', 'feedback pending' ] },
bodies_str => \@all,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order,
})->page( $page );
@@ -511,12 +515,14 @@ sub admin {
$c->stash->{reports_new} = $c->cobrand->problems->search( {
state => 'in progress',
bodies_str => $body->id,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order
} );
$c->stash->{reports_unpublished} = $c->cobrand->problems->search( {
state => 'feedback pending',
bodies_str => $body->parent->id,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order
} );
@@ -525,6 +531,7 @@ sub admin {
$c->stash->{reports_published} = $c->cobrand->problems->search( {
state => 'fixed - council',
bodies_str => $body->parent->id,
+ non_public => $internal ? 1 : 0,
}, {
order_by => $order
} )->page( $page );
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 97ac19761..ce38f65d4 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -769,12 +769,20 @@ subtest "phone number is mandatory" => sub {
$mech->content_contains( 'Diese Information wird benötigt' );
};
+my $internal;
subtest 'test flagged users make internal reports' => sub {
$user->update({ flagged => 1 });
$mech->submit_form( with_fields => { phone => "01234", category => 'Cat1', detail => 'Details' } );
- my $report = FixMyStreet::DB->resultset('Problem')->search(undef, { order_by => { -desc => 'id' }, rows => 1 })->single;
- is $report->non_public, 1;
- $report->delete;
+ $internal = FixMyStreet::DB->resultset('Problem')->search(undef, { order_by => { -desc => 'id' }, rows => 1 })->single;
+ is $internal->non_public, 1;
+};
+
+subtest 'internal report admin display' => sub {
+ $mech->get_ok('/admin/summary');
+ $mech->content_lacks('href="report_edit/' . $internal->id);
+ $mech->get_ok('/admin/summary?internal=1');
+ $mech->content_contains('href="report_edit/' . $internal->id);
+ $internal->delete;
$mech->log_out_ok;
};
diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html
index 502a7bc39..a138339e6 100644
--- a/templates/web/zurich/admin/problem_row.html
+++ b/templates/web/zurich/admin/problem_row.html
@@ -21,7 +21,8 @@
<td>[% prettify_state(problem.state) %]
[% IF problem.state == 'feedback pending';
SET cs=problem.get_extra_metadata('closure_status');
- IF cs %] ([% prettify_state(cs) %]) [% END; END %]</td>
+ IF cs %] ([% prettify_state(cs) %]) [% END; END %]
+ [% IF problem.non_public %]<br><i>Interne Meldung</i>[% END %]</td>
[% IF include_subdiv %]
<td>
diff --git a/templates/web/zurich/admin/reports/index.html b/templates/web/zurich/admin/reports/index.html
index ecb7c9519..e2790309b 100644
--- a/templates/web/zurich/admin/reports/index.html
+++ b/templates/web/zurich/admin/reports/index.html
@@ -1,4 +1,4 @@
-[% PROCESS 'admin/header.html' title=loc('Search Reports') %]
+[% PROCESS 'admin/header.html' title=loc('All Reports') %]
[% PROCESS 'admin/report_blocks.html' %]
<form method="get" action="[% c.uri_for_action('admin/reports/index') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
diff --git a/templates/web/zurich/header.html b/templates/web/zurich/header.html
index 49901ebb9..c9343d8d6 100644
--- a/templates/web/zurich/header.html
+++ b/templates/web/zurich/header.html
@@ -41,11 +41,20 @@
[% pagename = c.req.uri.path %]
[% pagename = pagename.replace('/admin/?(\w*).*', '$1') %]
+ [% IF admin_type == 'super' %]
<li [% IF pagename == 'summary' OR pagename == '' %]class="current"[% END %]>
<a href="/admin/summary">[% loc('Summary') %]</a>
</li>
+ [% ELSE %]
+ <li [% IF NOT c.get_param('internal') AND (pagename == 'summary' OR pagename == '') %]class="current"[% END %]>
+ <a href="/admin/summary">Öffentliche</a>
+ </li>
+ <li [% IF c.get_param('internal') AND (pagename == 'summary' OR pagename == '') %]class="current"[% END %]>
+ <a href="/admin/summary?internal=1">Interne</a>
+ </li>
+ [% END %]
<li [% IF pagename == 'reports' OR pagename == 'report_edit' %]class="current"[% END %]>
- <a href="/admin/reports">[% loc('Reports') %]</a>
+ <a href="/admin/reports">[% loc('All') %]</a>
</li>
[% IF admin_type == 'dm' OR admin_type == 'super' %]
<li [% IF pagename == 'bodies' OR pagename == 'body' %]class="current"[% END %]>