aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2015-02-04 14:52:12 +0000
committerDave Arter <davea@mysociety.org>2015-10-06 09:09:22 +0100
commit258a42d8973680824ad49ec7f9d8eddb58424262 (patch)
tree01a53337bcc193da76ac32415d864773f08a4eb6
parentde8ba7899dd4692cdf062f4b2735157f7fd14cb7 (diff)
[Zurich] all admin users can see stats
Admin CR4 https://github.com/mysociety/FixMyStreet-Commercial/issues/673 seems like admin_pages should be able to generate the menu, but this change also needs template change.
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm3
-rw-r--r--t/cobrand/zurich.t4
-rw-r--r--templates/web/zurich/header.html2
3 files changed, 5 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 9ed65c5f5..cded2c62d 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -289,11 +289,13 @@ sub admin_pages {
my $c = $self->{c};
my $type = $c->stash->{admin_type};
+
my $pages = {
'summary' => [_('Summary'), 0],
'reports' => [_('Reports'), 2],
'report_edit' => [undef, undef],
'update_edit' => [undef, undef],
+ 'stats' => [_('Stats'), 4],
};
return $pages if $type eq 'sdm';
@@ -305,7 +307,6 @@ sub admin_pages {
$pages = { %$pages,
'users' => [_('Users'), 3],
- 'stats' => [_('Stats'), 4],
'user_edit' => [undef, undef],
};
return $pages if $type eq 'super';
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 90a92fb44..6394c8942 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -503,7 +503,7 @@ like $email->body, qr/test\@example.com/, 'body does contain email address';
$mech->clear_emails_ok;
$mech->log_out_ok;
-subtest "only superuser can see stats" => sub {
+subtest "superuser and dm can see stats" => sub {
$user = $mech->log_in_ok( 'super@example.org' );
FixMyStreet::override_config {
@@ -520,7 +520,7 @@ subtest "only superuser can see stats" => sub {
}, sub {
$mech->get( '/admin/stats' );
};
- is $mech->res->code, 404, "only superuser should be able to see stats page";
+ is $mech->res->code, 200, "dm can now also see stats page";
$mech->log_out_ok;
};
diff --git a/templates/web/zurich/header.html b/templates/web/zurich/header.html
index 0d06d2c53..20d41b8bd 100644
--- a/templates/web/zurich/header.html
+++ b/templates/web/zurich/header.html
@@ -68,10 +68,10 @@
<li [% IF pagename == 'users' OR pagename == 'user_edit' %]class="current"[% END %]>
<a href="/admin/users">[% loc('Users') %]</a>
</li>
+ [% END %]
<li [% IF pagename == 'stats' %]class="current"[% END %]>
<a href="/admin/stats">[% loc('Stats') %]</a>
</li>
- [% END %]
<li class="search-box">
<form method="get" action="[% c.uri_for('reports') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
<input type="text" name="search" size="20" id="search" placeholder="[% loc('Search reports') %]">