diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 36 | ||||
-rw-r--r-- | templates/web/zurich/admin/header.html | 8 | ||||
-rw-r--r-- | templates/web/zurich/admin/index-dm.html | 27 |
4 files changed, 71 insertions, 4 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; diff --git a/templates/web/zurich/admin/header.html b/templates/web/zurich/admin/header.html index 1bb78c476..30c3496a9 100644 --- a/templates/web/zurich/admin/header.html +++ b/templates/web/zurich/admin/header.html @@ -8,12 +8,12 @@ select { width: auto; } </style> <p><strong>[% loc('FixMyStreet admin:') %]</strong> - <a href="summary">[% loc('Summary') %]</a> | - <a href="bodies">[% loc('Bodies') %]</a> | - <a href="reports">[% loc('Reports') %]</a> | + <a href="/admin/summary">[% loc('Summary') %]</a> | + <a href="/admin/bodies">[% loc('Bodies') %]</a> | + <a href="/admin/reports">[% loc('Reports') %]</a> | <!-- <a href="timeline">Timeline</a> | --> <!-- <a href="questionnaire">Survey</a> | --> - <a href="users">[% loc('Users') %]</a> + <a href="/admin/users">[% loc('Users') %]</a> <!-- <a href="flagged">Flagged</a> | --> <!-- <a href="stats">Stats</a> --> diff --git a/templates/web/zurich/admin/index-dm.html b/templates/web/zurich/admin/index-dm.html new file mode 100644 index 000000000..8eea65019 --- /dev/null +++ b/templates/web/zurich/admin/index-dm.html @@ -0,0 +1,27 @@ +[% INCLUDE 'admin/header.html' title=loc('Summary') -%] +[% PROCESS 'admin/report_blocks.html' %] + +<h2>New reports</h2> + +<table cellspacing="0" cellpadding="2" border="1"> + <tr> + <th>[% loc('ID') %]</th> + <th>[% loc('Title') %]</th> + <th>[% loc('Category') %]</th> + <th>[% loc('Created') %]</th> + <th>*</th> + </tr> +[%- FOR problem IN unconfirmed.all %] + <tr[% ' class="hidden"' IF problem.state == 'hidden' %]> + <td>[% problem.id %]</td> + <td>[% PROCESS value_or_nbsp value=problem.title %]</td> + <td>[% problem.category %]</td> + <td>[% PROCESS format_time time=problem.created %]</td> + <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> + </tr> +[%- END -%] +</table> +[%# WHILE ( problem = unconfirmed.next ) %] +[%# END %] + +[% INCLUDE 'admin/footer.html' %] |