diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 36 |
2 files changed, 40 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 0fd98733f..c38c2b7da 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -60,6 +60,10 @@ Displays some summary information for the requests. sub index : Path : Args(0) { my ( $self, $c ) = @_; + if ($c->cobrand->moniker eq 'zurich') { + return $c->cobrand->admin(); + } + my $site_restriction = $c->cobrand->site_restriction(); my $problems = $c->cobrand->problems->summary_count; diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 7255906c7..73e36ebd4 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -36,4 +36,40 @@ sub show_unconfirmed_reports { 1; } +# Specific administrative displays +sub admin_type { + my $self = shift; + my $c = $self->{c}; + my $user = $c->user; + my $body = $user->from_body; + $c->stash->{body} = $body; + + my $parent = $body->parent; + my $children = $body->bodies; + + if (!$parent) { + return 'super'; + } elsif ($parent && $children) { + return 'dm'; + } elsif ($parent) { + return 'sdm'; + } +} + +sub admin { + my $self = shift; + my $c = $self->{c}; + my $type = $self->admin_type(); + + if ($type eq 'dm') { + $c->stash->{template} = 'admin/index-dm.html'; + $c->stash->{unconfirmed} = $c->cobrand->problems->search({ + state => 'unconfirmed', + bodies_str => $c->stash->{body}->id, # XXX No multiples or missing + }); + } elsif ($type eq 'sdm') { + $c->stash->{template} = 'admin/index-sdm.html'; + } +} + 1; |